greenrd
21st June 2004, 02:31 AM
Suppose I have this line in a shell script
foo | tee bar
How do I make it so the script will exit if foo exits with a non-zero error code? (Preferably I want the script to return the same error code as foo returned.)
Normally, I would do:
foo || exit $?
but because of the | I can't seem to get that to work.
foo | tee bar
How do I make it so the script will exit if foo exits with a non-zero error code? (Preferably I want the script to return the same error code as foo returned.)
Normally, I would do:
foo || exit $?
but because of the | I can't seem to get that to work.