I have a bash script that runs a command and pipes its output to 'tee' which splits it into two log files for later parsing. I need to catch the exit code from the command right before piping. How?
Code:
/usr/bin/command1 parameter1 --option1 2>&1 | tee -a $LOG1 $LOG2
if [ $? != 0 ]; then
do some shit
else
do other shit
fi
It appears that I'm catching the result of 'tee' and not of 'command1'.
Thanks,
prl77
PS. I'm going on vacation tomorrow, will respond back in a week.