This command does not store the output of my script in the log file:
. myscript.sh | tee -a log_file.log
However this next command does store the output in the log file.
. myscript.sh 2>&1 | tee -a dash_log.log
Why does the second one work and not the first? AFAIK the only difference is that I have told bash to redirect stderr to stdout, and it should not make any difference to what happens with stdout. Yet that first command would not even store the 'error-less' version of stdout in the log file.
And in case it matters: I'm on Ubuntu 12.04 hosted on AWS
EDIT: This was caused by erroneous assumptions of how wget outputs messages. See https://stackoverflow.com/questions/13066518/why-does-wget-output-to-stderr-rather-than-stdout and http://www.gnu.org/software/wget/manual/html_node/Logging-and-Input-File-Options.html
source ~/.bashrc
, then loops through some urls callingwget "theurl.com" --output-document="local/dir/theurl.com"
for each one. All the script output comes from wget.timestamp - url; transfer messages; "Saving to: ..."; 0K .......... 31.9M=0s