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

Re: 'while do done' hangs interactive zsh



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