Using ksh, I want to pipe several commands together, but be able to
determine the exit status of the first command in the pipe:
#!/usr/bin/ksh
firstcmd 2>&1 | tee /dev/console >>$logfile
exit_status=$?
if [ $exit_status = 0 ] ; then
etc...
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
Phil
--
University of New England
Northern Rivers
Lismore NSW Australia