bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: different exit codes in $? and ${PIPESTATUS[@]}


From: Wladimir Sidorenko
Subject: Re: different exit codes in $? and ${PIPESTATUS[@]}
Date: Sat, 13 Oct 2012 00:36:41 +0300

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.

2012/10/13 Chet Ramey <chet.ramey@case.edu>:
> On 10/10/12 10:38 AM, Wladimir Sidorenko wrote:
>> Dear all,
>>
>> After running the following command:
>>
>> $  ! test 0 -eq 0
>>
>> I can see different exit codes in $? and ${PIPESTATUS[@]}. Here, what I get
>>
>> $ ! test 1 -eq 0 ; echo $? ${PIPESTATUS[@]}
>> 0 1
>>
>> $ ! test 0 -eq 0 ; echo $? ${PIPESTATUS[@]}
>> 1 0
>>
>> I'd like to know whether that's a desired behavior or a bug.
>
> The current behavior is the intended behavior.  PIPESTATUS reflects the
> "true" return status(es) of the process(es) in the pipeline, before any
> inversion of the pipeline's exit status.  That's what seems the most
> useful.
>
> 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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]