[clug] Tee eats the return code of the previous entry in the pipeline

Michael Still mikal at stillhq.com
Tue Mar 9 06:18:40 GMT 2004

Consider this:

 > cat fail
exit 1
 > ./fail; echo $?
 > ./fail | tee - /tmp/foo; echo $?

This makes me very sad. I want to be able to run a command, dump it's 
output to a file and to the console (in real time), and still have 
access to it's return code.

Anyone have any suggestions as to how I might go about achieving that?



Michael Still (mikal at stillhq.com) | "All my life I've had one dream,
http://www.stillhq.com            |  to achieve my many goals"
UTC + 11                          |    -- Homer Simpson

More information about the linux mailing list