|
Checking return value of commands in pipe
Hi,
I am wondering how I can check the return value of all commands in a pipe such as
gzip -dc file.gz | sort -u > output.txt
If I run this sequence in bash and check $?, I get the return status from sort. But I want to know if the initial gzip failed.
Similarly for longer pipe chains, I want to know if any of the components returned an error status.
I don't mind if you give a solution for another shell such as tcsh. Any solution is great!
Thanks!
|