Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: behavior of test true -a \( ! -a \)
- X-seq: zsh-workers 52807
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: behavior of test true -a \( ! -a \)
- Date: Sat, 23 Mar 2024 22:52:07 -0400
- Archived-at: <https://zsh.org/workers/52807>
- Feedback-id: iaa214773:Fastmail
- In-reply-to: <CAH+w=7YUUx5ob=Fa9YvUi2dAzuMNrBR96U0wUvVFZdMSRH9wWA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- 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> <20240323222036.GE164665@qaa.vinc17.org> <CAH+w=7Y5isnk+tCFWkjhw7e7d9Q7X_zeMqtOHps9SfX3zvsBJg@mail.gmail.com> <81df9600-a0c4-4c7b-a4fb-f61106395b96@app.fastmail.com> <CAH+w=7YUUx5ob=Fa9YvUi2dAzuMNrBR96U0wUvVFZdMSRH9wWA@mail.gmail.com>
On Sat, Mar 23, 2024, at 8:14 PM, Bart Schaefer wrote:
> On Sat, Mar 23, 2024 at 4:33 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
>>
>> The next version of POSIX will only specify what happens with four
>> arguments if the very first one is "!". The "-a" and "-o" primaries
>> and the "(" and ")" operators have been removed.
>
> So, no "and"/"or" at all, and no grouping? Or are they just demoted
> from "primary" and "operator" in some way?
The former -- everything marked "OB" in the current "test" spec [1]
has been completely excised from the upcoming one (although shells
can retain them as extensions to the standard, to avoid breaking
scripts). The current "Application Usage" section [2] already
recommends that portable scripts stick to simpler "test" commands
connected with general shell syntax, like so:
test -f "$foo" || { test ! "$bar" && test -d "$baz"; }
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
[2]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_16
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author