Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: behavior of test true -a \( ! -a \)
- X-seq: zsh-workers 52803
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: behavior of test true -a \( ! -a \)
- Date: Sat, 23 Mar 2024 23:20:36 +0100
- Archived-at: <https://zsh.org/workers/52803>
- In-reply-to: <CAH+w=7bAB+cx-f_qBMKoec=Hdyj_s_pRUeiE8K8wyr_ig1rDeQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- References: <20240321100710.GA164665@qaa.vinc17.org> <CAH+w=7a+P6d_D3BxiO7hqPji9LbduYcu53ZFOSbg8DkL4QK8og@mail.gmail.com> <CAH+w=7bAB+cx-f_qBMKoec=Hdyj_s_pRUeiE8K8wyr_ig1rDeQ@mail.gmail.com>
On 2024-03-23 14:48:36 -0700, Bart Schaefer wrote:
> I'd therefore argue that it's actually
>
> % test \( ! -a \)
>
> that is wrong: It should be complaining of a missing close paren,
> rather than magically reverting to treating "!" as "not" (and also
> "-a" as a plain string). It's entirely dependent on the count of
> arguments rather than on treating parens as tokens.
POSIX specifies what happens with up to 4 arguments. The idea is to
interpret the operators in a way so that the expression is meaningful
rather than having an incorrect syntax.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author