Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16729

Re: Undocumented for-loop construct

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From worley@alum.mit.edu (Dale R. Worley)
Newsgroups gnu.bash.bug
Subject Re: Undocumented for-loop construct
Date Thu, 06 Aug 2020 22:29:38 -0400
Lines 17
Approved bug-bash@gnu.org
Message-ID <mailman.1068.1596767403.2739.bug-bash@gnu.org> (permalink)
References <CAGqdar04i1z28vYUFuGr=7WZOUsar8JE+QW0TAm1bnP0+DtEjQ@mail.gmail.com> <87364zur1p.fsf@hobgoblin.ariadne.com>
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1596767404 28947 209.51.188.17 (7 Aug 2020 02:30:04 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To Klaas Vantournhout <klaas.vantournhout@gmail.com>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1596767392; bh=zx3+sP244P4S5Jgrih+fH4OQ6BJPVwcAJiDQnG92n4U=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-ID; b=S8xTN/GEDNRTa/JSCRUtISTjlzQkRRFjMUlKyemINRQE0nK9VYE/6Zq0LDNKLEESX XpznReIO2n5aDNN80WLfWosxGhSeB+t6VOGoP1WIg/6wRprZqyQ9Mig4inO1ZjVBUM cl340LoZL8dxf4I91t1lgm2dkPjK3AZUnZ1YsfreLPuJLaZ+kv8/6f0axmM0fcTK2p yyjktAu6NxT7xJQ+SXO9ZvX1cV+WiAjxhyCVLLgGNWsinE1TigT9ECgh61H/M2xO7+ aw722TezMOkj8xNUzGmvebe8X748+NIYqPIKMxNJkYatgnDz3bayG0+12qhJCzRsoW BS9CDCc/m9wbA==
X-Xfinity-VMeta sc=-100.00;st=legit
X-Authentication-Warning hobgoblin.ariadne.com: worley set sender to worley@alum.mit.edu using -f
In-Reply-To <CAGqdar04i1z28vYUFuGr=7WZOUsar8JE+QW0TAm1bnP0+DtEjQ@mail.gmail.com> (klaas.vantournhout@gmail.com)
Received-SPF softfail client-ip=2001:558:fe21:29:69:252:207:39; envelope-from=worley@alum.mit.edu; helo=resqmta-ch2-07v.sys.comcast.net
X-detected-operating-system by eggs.gnu.org: First seen = 2020/08/06 22:29:52
X-ACL-Warn Detected OS = ???
X-Spam_score_int -11
X-Spam_score -1.2
X-Spam_bar -
X-Spam_report (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no
X-Spam_action no action
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <87364zur1p.fsf@hobgoblin.ariadne.com>
Xref csiph.com gnu.bash.bug:16729

Show key headers only | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Undocumented for-loop construct worley@alum.mit.edu (Dale R. Worley) - 2020-08-06 22:29 -0400

csiph-web