Sample Header Ad - 728x90

Get exit status of process that's piped to another

532 votes
22 answers
282059 views
I have two processes foo and bar, connected with a pipe: $ foo | bar bar always exits 0; I'm interested in the exit code of foo. Is there any way to get at it?
Asked by Michael Mrozek (95515 rep)
Jun 2, 2011, 08:19 PM
Last activity: Jan 23, 2025, 06:50 PM