Re: test incorrectly rejecting valid expression with confusing ! placement

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

 



Harald van Dijk dixit:

>$ src/dash -c 'test ! ! = !'
>src/dash: 1: test: =: unexpected operator
>
>POSIX requires special behaviour for four-argument tests:

Right but…

>There are also some cases where test gives incorrect results when
>combining ! with -o

… ‘-o’ is XSI, not POSIX. Do not expect…

>$ src/dash -c 'test ! "" -o !'; echo $?

… this to work.

>This is covered by the special rule for four arguments, there ! as the
>first argument evaluates the remaining three-argument test and negates
>the result. In this special case, ! does not have higher precedence than
>-o, so the correct exit status is 1, which bash's test gives.

Only for a shell implementing the XSI ‘-o’ for POSIX test.
You shouldn’t use -o anyway as it’s deprecated.

bye,
//mirabilos
-- 
FWIW, I'm quite impressed with mksh interactively. I thought it was much
*much* more bare bones. But it turns out it beats the living hell out of
ksh93 in that respect. I'd even consider it for my daily use if I hadn't
wasted half my life on my zsh setup. :-) -- Frank Terbeck in #!/bin/mksh

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux