Redirect / Log the Output of a Bash Shell Script from within the Script

It is a common practice to use 1>/dev/null 2>&1 after commands to suppress any kind of output completely. The same technique is also used to redirect the output to a text file for logging purposes instead of /dev/null. For eg. echo "hello" 1>/tmp/hellolog 2>&1 However if you are writing a rather long bash script, it [...]