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: Chet Ramey
Subject: Re: different exit codes in $? and ${PIPESTATUS[@]}
Date: Sun, 14 Oct 2012 13:10:17 -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 7:26 AM, Dan Douglas wrote:
> On Sunday, October 14, 2012 11:46:17 AM Wladimir Sidorenko wrote:
>> To my mind '!' looks pretty much like a unary operator and '|' like a binary 
> one.
> 
> This isn't as confusing as the associativity and nesting problem.

Think of `!' and `time' as reserved words that modify a pipeline rather
than operators that begin one.  You can stack `!' and `time' so that
consecutive instances modify the same pipeline rather than delimit them.
It's a little easier to see how ! ! is a no-op that way.

There was an extensive discussion of this on the Posix list back a
couple of years.  Geoff Clare wrote the final version of a set of
proposed changes that made a distinction between pipelines, `unadorned'
pipelines, `negated' pipelines, `timed' pipelines, and allowed the `!'
and `time' reserved words to modify the same pipeline.  I'm not sure why
a lot of that work didn't make it into the published standard, but it
was clarifying.

https://www5.opengroup.org/sophocles2/show_mail.tpl?CALLER=show_archive.tpl&source=L&listname=austin-group-l&id=12082

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]