On 9/25/16 5:57 PM, Martijn Dekker wrote:
> Op 25-09-16 om 22:40 schreef isabella parakiss:
>> On 9/25/16, Martijn Dekker <mart...@inlv.org> wrote:
>>> The '!' operator in the legacy test/[ builtin does not invert the result
>>> of the -o operator. Consequently the command
>>>
>>>     [ ! -o noclobber ]
>>>
>>> amounts to a no-op, always returning exit status 0.
> [...]
>> [ ! -o noclobber ] means
>> is '!' a non empty string?  if not, is 'noclobber' a non empty string?
> 
> Wow. Yeah, I suppose that's one possible interpretation. I was going for
> the POSIX one:
> 
> | These primaries can be combined with the following operators:
> |
> | !  expression
> |     True if expression is false. False if expression is true.
> Ref:
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128

You need to look at the part of the Posix description where the behavior is
described as being based on the number of arguments.  In particular:

3 arguments:

        If $2 is a binary primary, perform the binary test of $1 and $3.

-a and -o are considered binary primaries for the purposes of a three-
argument test.  This is spelled out pretty clearly in the bash
documentation.

Chet


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

Reply via email to