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


Groups > gnu.bash.bug > #16728 > unrolled thread

Undocumented for-loop construct

Started byKlaas Vantournhout <klaas.vantournhout@gmail.com>
First post2020-08-06 23:50 +0200
Last post2020-08-06 23:50 +0200
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Undocumented for-loop construct Klaas Vantournhout <klaas.vantournhout@gmail.com> - 2020-08-06 23:50 +0200

#16728 — Undocumented for-loop construct

FromKlaas Vantournhout <klaas.vantournhout@gmail.com>
Date2020-08-06 23:50 +0200
SubjectUndocumented for-loop construct
Message-ID<mailman.1054.1596751404.2739.bug-bash@gnu.org>
Dear Bash-developers,

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:


https://stackoverflow.com/questions/63247449/alternate-for-loop-construct

The community is unable to find any reference to this feature, except

* a brief slide in some youtube presentation by Stephen Bourne:

    https://www.youtube.com/watch?v=2kEJoWfobpA&t=2095
    Relevant part starts at 34:55

* and the actual source code of bash and the Bourne Shell V7

Questions:
1) Is there a reason why this is undocumented?
2) Can this become documented?
3) What is the historical background behind this alternative construct?

Thanks in advance,

Klaas

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web