Print stdout and stderr to screen + log file and catch any errors in shell script
Hello!
I'm writing a shell script that executes a command. I want to save both stdout and stderr to the same log file + print to sceen and at the same time catch if there is an error. What I have so far is: Code:
set -o pipefail Thanks in advance! |
yes, tee will eat up the error code.
try the following: Code:
set -o pipefail |
Incidentally, '==' is a string comparator; you'd want '-eq'
http://tldp.org/LDP/abs/html/comparison-ops.html |
Thank you pan64, your solution worked just fine! I used the code below
Code:
set -o pipefail |
All times are GMT -5. The time now is 04:38 AM. |