I'm trying to add logging to an existing script which echos a number of lines to the screen. I've added a switch to the script that is going to suppress much of this output and put it in a file instead.
The way I envisioned it was like this:
$log would be set to either "" or the log files redirection
log=">> ./tstlogfile.txt"
echo "Text to terminal"
echo "text to log file" $log
I thought this would work, but it takes my redirection string literally... is there an easy way of doing this that I'm missing?