in reply to Re^2: EXIT code
in thread EXIT code
You can complicate things if you want both standard output and error captures, like:ERRORTEXT=`perl -e 'die "Oops"' 2>&1 1>/dev/null` ERRORCODE=$?
Above sniplet prints Hello to standard error(!) and captures the result of 'die' in $ERRORTEXT. But then: why not extend your Perl program to handle what you want in the first place?ERRORTEXT=`perl -e 'print "Hello\n";die "Oops"' 3>&1 1>&2 2>&3` ERRORCODE=$?
Paul
|
|---|