[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: different exit codes in $? and ${PIPESTATUS[@]}
From: |
Chet Ramey |
Subject: |
Re: different exit codes in $? and ${PIPESTATUS[@]} |
Date: |
Sat, 13 Oct 2012 20:31:36 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 |
On 10/12/12 5:36 PM, Wladimir Sidorenko wrote:
> Ok, thanks. I'll notice this for the future. It's of course arguable,
> whether PIPESTATUS stores a true value, since the '!' inversion
> keyword gets ignored in this case. But if it was intended, than it's
> ok.
The case where PIPESTATUS stores only a single exit status is the
degenerate case. Pipelines have multiple elements.
What do you think should happen in the following case?
! exit 1 | exit 2 | exit 3
$? reflects only the status of the pipeline, which in this case is the
(inverted) status of the final command. Why should $PIPESTATUS not
reflect the actual exit statuses?
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/10
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Andreas Schwab, 2012/10/10
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/12
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/12
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Eric Blake, 2012/10/12
- Re: different exit codes in $? and ${PIPESTATUS[@]},
Chet Ramey <=
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Andreas Schwab, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Dan Douglas, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Dan Douglas, 2012/10/15
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/15
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/14