Using ksh, I want to pipe several commands together, but be able to
determine the exit status of the first command in the pipe:
firstcmd 2>&1 | tee /dev/console >>$logfile
if [ $exit_status = 0 ] ; then
Using the above script, exit_status is set to the exit status of "tee".
However, I'm interested in the exit status of "firstcmd"
Any ideas? I could of course spool the output of firstcmd to a temporary
file but then the console wouldn't see any error messages until "firstcmd"
exited ... not really what I want to happen.
Thanks in advance
University of New England
Lismore NSW Australia