bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Undocumented for-loop construct


From: Dale R. Worley
Subject: Re: Undocumented for-loop construct
Date: Thu, 06 Aug 2020 22:29:38 -0400

Klaas Vantournhout <klaas.vantournhout@gmail.com> writes:
> Recently I came across a surprising undocumented bash-feature
>
>    $ for i in 1 2 3; { echo $i; };
>
> The usage of curly-braces instead of the well-documented do ... done
> construct was a complete surprise to me and even lead me to open the
> following question on stack overflow:

Interesting!  Looking at parse.y, it looks like do ... done can be
replaced with { ... } in 'for' and 'select' statements, but not 'while'
and 'until' statements.  Not clear why that would be, though I haven't
tried extending while/until and recompiling parse.y; maybe it doesn't
work.

Dale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]