> If test were modified to process
> all its arguments at the start (presumably building an expression
> tree), it could then complain about excess arguments again.
I have a modified version of test which uses a parameter for e(),
e1(), etc to determine whether sub-expressions should be evaluated
or just parsed. This allows the whole test command to be checked
for syntax, while preserving the lazy semantics ("short circuit")
of -a and -o.
I haven't submitted it because it seems somehow clunky.
A much simpler change would be just to have -a and -o behave like &
and | instead of like && and ||; in other words, to perform both tests
(and therefore syntax check the whole command) before combining the
boolean results. I've looked at the posix description of test and it
doesn't actually say that -a and -o have to be lazy. Would this cause
any problems in practice?
-- Richard