in reply to Redirecting STDOUT and standard error to file
(/bin/foo ; echo $? >RES)| tee -a $LOGFILE export ERR=$(cat RES)
But i was unable to get it to work (PIPESTATUS seemed to always have just one element of 0)...$ cat test #!/bin/bash echo foo sleep 2 echo bar false $ ./test | tee blah foo [.. seconds later..] bar $ echo ${PIPESTATUS[@]} 1 0 # (so ${PIPESTATUS[0]} should give you the return of the first comma +nd).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Redirecting STDOUT and standard error to file
by ikegami (Patriarch) on Sep 08, 2005 at 21:14 UTC |