The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-22-2007
btherl btherl is offline
Registered User
 

Join Date: Apr 2007
Posts: 3
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!
Reply With Quote
Forum Sponsor