[Top][All Lists]

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

Re: Undocumented for-loop construct

From: Lawrence Velázquez
Subject: Re: Undocumented for-loop construct
Date: Thu, 6 Aug 2020 22:42:48 -0400

> On Aug 6, 2020, at 10:29 PM, Dale R. Worley <worley@alum.mit.edu> wrote:
> 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

Unless I'm quite mistaken, our very own Oğuz left the only answer
on the OP's Stack Overflow question, explaining that braced forms
of the other compound commands would be syntactically ambiguous.



reply via email to

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