Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: behavior of test true -a \( ! -a \)



On Sat, Mar 23, 2024 at 3:20 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> On 2024-03-23 14:48:36 -0700, Bart Schaefer wrote:
> > I'd therefore argue that it's actually
> >
> > % test \( ! -a \)
> >
> > that is wrong
>
> POSIX specifies what happens with up to 4 arguments.

Ok, but

% test \( ! -a \) \)

has five and

% test \( ! -a \) -a true

has six, and in neither case are the "first four" interpreted as you
would have the "last four" interpreted in

% test true -a \( ! -a \)

> The idea is to
> interpret the operators in a way so that the expression is meaningful

The only way to do that is to (in effect) start counting arguments
again when \( is encountered.  That changes the meaning of everything
with an open paren and more than four words.  At what point do we
stop?




Messages sorted by: Reverse Date, Date, Thread, Author