Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: behavior of test true -a \( ! -a \)
- X-seq: zsh-workers 52805
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: behavior of test true -a \( ! -a \)
- Date: Sat, 23 Mar 2024 19:33:18 -0400
- Archived-at: <https://zsh.org/workers/52805>
- Feedback-id: iaa214773:Fastmail
- In-reply-to: <CAH+w=7Y5isnk+tCFWkjhw7e7d9Q7X_zeMqtOHps9SfX3zvsBJg@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>
On Sat, Mar 23, 2024, at 6:41 PM, Bart Schaefer wrote:
> 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.
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.
> 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?
The current version of POSIX leaves test(1) behavior with more than
4 arguments unspecified but says that:
On XSI-conformant systems, combinations of primaries and
operators shall be evaluated using the precedence and
associativity rules described previously. In addition, the
string comparison binary primaries '=' and "!=" shall have
a higher precedence than any unary primary.
I suspect that the Austin Group gave up on the whole thing once
they realized its general intractability.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author