Lynn Kerby <l...@kerbit.net> writes: > Use of the '-a' option to the builtin test command fails to > produce the correct result when used with negation. The specific > error the case where the file exists and a "test ! -a file" is > executed. If the script is changed to use '-e' for file > existence the result is correct as expected. If the script is > modified to place parenthesis around the '-a file' expression, > the result is also correct.
This is not a bug, but consistent with the POSIX rules. Better avoid the (nonstandard) -a unary operator and use -e instead. The problem is that -a is also a binary operator, and POSIX says that if test is called with three arguments and the second argument is a binary operator it should be parsed as such. See <http://opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_05> for details. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."