On 2006-09-13 16:32:35 +0200, Vincent Lefevre wrote: > The zsh test builtin is incompatible with /usr/bin/test from the > coreutils and with the builtin in bash. In zsh, > > test -n -a -n "" > > doesn't output any error message, whereas /usr/bin/test from the > coreutils outputs: > > /usr/bin/test: extra argument `-n' > > and the builtin in bash outputs: > > bash: test: too many arguments > > Compatibility is important, in particular because the test builtin > was added for compatibility (as the zshbuiltins man page says).
Also the above example in incompatible with the [[ ]] builtin: vin% [[ -n -a -n "" ]] zsh: unrecognized condition: `-a' As far as POSIX is concerned, test -n -a -n "" is unspecified, so it doesn't break conformance. But an error message and a non-zero exit status would be better for the user. But the following test is valid and completely specified by POSIX[*], though the zsh test builtin outputs an error message: vin% test \( \! -e \) test: argument expected [*] http://www.opengroup.org/onlinepubs/009695399/utilities/test.html FYI, the bash [ builtin has a similar problem, but the 'test' utility from the coreutils behaves correctly. -- Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)