tags 426990 + moreinfo
found 426990 bash/4.1-3
quit
Hi Masanobu,
OZAKI Masanobu wrote:
> Please try
> % bash -c 'test ! -a . && echo true'
> and compare with the result of
> % bash -c '/usr/bin/test ! -a . && echo true'
So which one is right?
My first reading was:
test ! -a .
= test ! && test .
= test -n ! && test -n .
= true && true
= true
though I expect you were looking for:
test ! -a .
= ! test -a .
= ! test -e .
= ! true
= false
> What is interesting is that the results of
> % bash -c 'test ! -z foo && echo true'
> and
> % bash -c '/usr/bin/test ! -z foo && echo true'
Right, this one is not ambiguous.
My recommendation is to never use the ! or -a 'test' operators.
They are superfluous next to the shell-supported ! and &&.
POSIX does not mandate support for -a (though XSI does), perhaps for
this reason.
Hope that helps,
Jonathan
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]