Bash Advanced Scripting and File I/O