-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Finn Wilcox on 12/8/2007 7:34 AM: > $ test ! -a /dev/null ; echo $? > 0 > > $ /bin/test ! -a /dev/null ; echo $? > 1 > > The fourth case is surprising. > Is -a supposed to be equivalent to -e and why is it needed?
In general, the use of -a is non-portable. POSIX does not mention the unary -a (although bash provides it as a traditional synonym for -e), and states that binary -a (logic and of two tests) is optional in general (although binary -a is required on XSI implementations). For this reason, the next version of POSIX is marking -a as obsolescent, and the replacement is to use -e when you mean file existence, and 'test cond1 && test cond2' when you mean logical and. For more details, read Austin Interpretation 107: http://www.opengroup.org/austin/interps/uploads/40/10043/AI-107.txt Therefore, I see no bug in bash, even though it differs from coreutils in its interpretation of 'test ! -a file'. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHXAp784KuGfSFAYARAlAHAKDGyZqiZ9YEuxNIJS+hccvGsUItRQCfXpKF ll6kuEIgPnYt/cfS/qxupis= =BwY5 -----END PGP SIGNATURE-----