[clug] Tee eats the return code of the previous entry in the
kim.holburn at anu.edu.au
Tue Mar 9 06:48:34 GMT 2004
At 5:22 PM +1100 2004/03/09, Damien Elmes wrote:
>Michael Still <mikal at stillhq.com> writes:
>> 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.
>mobile% cat > foo
>mobile% exit=$((sh foo; echo $?) | tee - /tmp/foo); echo $exit
>If the command printed output you could of course just use the last
>line of output (since the exit code will be printed after any output
>from the app / script.
How about :
(window 1) cat fail > /tmp/foo
(window 2 (^A^C)) less +F /tmp/foo
Network Consultant - Telecommunications Engineering
Research School of Information Sciences and Engineering
Australian National University - Ph: +61 2 61258620 M: +61 0417820641
Email: kim.holburn at anu.edu.au - PGP Public Key on request
Life is complex - It has real and imaginary parts.
Andrea Leistra (rec.arts.sf.written.Robert-jordan)
More information about the linux