NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Wednesday May 26, 2004
Bash pipe exit codes
So the question for the day is:
The exit code of a pipe is the result of the last executed command...
How do I know if any of the other commands originated an exit code different
from 0? :-| Is this possible at all?
Some examples (with Perl ;-) ):
perl -e 'exit 3' | perl -e 'exit 2'
exit code => 2
perl -e 'exit 3' | perl -ne 'exit 2'
exit code => 3
perl -e 'exit 3' | perl -e 'exit 0'
exit code => 0
How can I get that 3 on the first and last examples? :-|
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.