-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Eric Blake on 1/7/2006 8:17 AM: > > Now, in this case, you have three arguments, and POSIX requires that the > binary operator "-a" have higher precedence than the "!" negation operator > on a 2-argument test. And the one-argument test of "!" and of "testFile" > both return true (since neither is the empty string), so the overall > expression returns 0.
Correcting myself, POSIX does not require any precedence between the two forms (it looks like an editorial oversight from the OPERANDS section). But the RATIONALE (XCU line 35443) states that "The ! operator has higher precedence than the -a operator, and the -a operator has higher precedence than the -o operator." Therefore, when -a is defined as a unary operator, an XSI compliant test is required to return failure for "test ! -a file" if file exists. Bash got this wrong, so indeed it is a bug. - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDxl0S84KuGfSFAYARAj6WAJ44nX0B2O5D+LvuiT3NNJ+c3GljugCdGOA5 UCxNICnejGO98ZJFlKDjZqo= =FNG7 -----END PGP SIGNATURE----- _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash