On 3/27/24 7:40 AM, Andreas Schwab wrote:

The check for whether the first argument is '!' is not performed,
because the "$2 is a binary primary" check comes first.  This is how
POSIX documents it.

FWIW, ksh parses it the other way round:

$ ksh93 -c '[ ! -a /tmp ]; echo $?; [ . -a /tmp ]; echo $?; [ - -a /tmp ]; echo 
$?'
1
0
ksh93: [: -: unknown operator
2

Bash uses the order POSIX specifies. -a and -o are binary primaries when
test gets three arguments.

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


Reply via email to