Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 'while do done' hangs interactive zsh
- X-seq: zsh-workers 48844
- From: Lawrence Velázquez <larryv@xxxxxxx>
- To: "Mikael Magnusson" <mikachu@xxxxxxxxx>, "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- Cc: "Arseny Maslennikov" <ar@xxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: 'while do done' hangs interactive zsh
- Date: Sun, 16 May 2021 12:22:34 -0400
- Archived-at: <https://zsh.org/workers/48844>
- In-reply-to: <CAHYJk3SHxn0hdsnTfOA3c9Hj=7q-nPCVAb1MEgS9MFtu-Ea=dA@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <YKDi6GYtnBt1ZYTU@cello> <CAH+w=7a-B+Zm4NWXS9bd1owjePHoS_O2dQT7dkEi3iU8DArPuQ@mail.gmail.com> <CAH+w=7YDmYz8p4HwGHgbSZ0h+=OH2fztNtfZaF-t9LmSKEV=Sg@mail.gmail.com> <CAHYJk3SHxn0hdsnTfOA3c9Hj=7q-nPCVAb1MEgS9MFtu-Ea=dA@mail.gmail.com>
On Sun, May 16, 2021, at 12:15 PM, Mikael Magnusson wrote:
> On 5/16/21, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > The attached makes both "while do" and "do done" into parse errors; I
> > didn't want to try messing with the tokenizer, so better solutions are
> > welcome.
>
> I use "do done" in production code so you can't remove that. I could
> imagine someone using "while do" too, but I don't so I won't complain
> about that part :). It is faster to not run the builtin "true" than it
> is to run it, and it has been valid syntax all these years.
It seems to agree with zshmisc(1) as well (a naïve reading of it, at least):
A list is a sequence of zero or more sublists, in which each sublist is
terminated by `;', `&', `&|', `&!', or a newline.
[...]
while list do list done
Execute the do list as long as the while list returns a zero
exit status.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author