[Top][All Lists]

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

Re: different exit codes in $? and address@hidden

From: Chet Ramey
Subject: Re: different exit codes in $? and address@hidden
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?

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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