Re: different exit codes in $? and ${PIPESTATUS[@]}
From:
Chet Ramey
Subject:
Re: different exit codes in $? and ${PIPESTATUS[@]}
Date:
Sun, 14 Oct 2012 12:10:15 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
On 10/14/12 4:46 AM, Wladimir Sidorenko wrote:
>> What do you think should happen in the following case?
>> ! exit 1 | exit 2 | exit 3
>
> To my mind the '!' operator should have had a higher precedence during
> parsing command line arguments than the pipe and applied only to the
> command it was immediately preceding.
You're free to feel that way, but existing shells don't implement it like
that, and Posix doesn't agree with you.
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/