[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#270868: Should not implement "test" builtin



> > But requiring support for test "-a"/"-o" is a bad idea however you word
> > it.
> Why?

Not all implementations of "test"/"[" use the same operator precedence
for "-a" and "-o".  This can introduce portability problems and confusion
for anyone using "test" as either a shell builtin or a standalone utility.
"&&" and "||", on the other hand, have equal precedence in every shell
of which I'm aware, and there are no portability problems with "&&" and
"||".  POSIX does not require conforming implementations of "test" to
understand either "-a" or "-o".  POSIX does require conforming
shells to understand "&&" and "||".  Some implementations of "test"/"["
have "-a" or "-o" as a unary operator.  Some implementations of
"test"/"[" have "-a" or "-o" as a binary operator.  These can introduce
portability problems and confusion for anyone using "test" as either a
shell builtin or a standalone utility.

Also, "-a" and "-o" are ugly.



Reply to: