I have seen lots of entries on stderr and stdout, but I did not see a solution to my question.
In running a script, I call another script. I want to capture output and error messages from the called script. I am able to redirect the stdout from the called script to my output file, but I don't seem able to capture the stderr portion.
Here is my line calling the script:
$READSCRIPT $ERRFILE | grep $RECNUMBER: >> $MAILFILE 2>&1
$READSCRIPT is the outside script I am calling.
$ERRFILE is a file name parameter I am passing to that script
$MAILFILE is the output file
When I run the script: sh -x tim_gap
Here is an example of an error message in the screen output:
gzcat: 00035146.20110829_-_2342+1900.gz: No such file or directory
However, when I look at my output file, $MAILFILE, the error message does not exist. I do capture the stdout messages into $MAILFILE. Am I using the proper syntax?
I appreciate any suggestions.
Thanks.