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


Groups > gnu.bash.bug > #16728

Undocumented for-loop construct

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Klaas Vantournhout <klaas.vantournhout@gmail.com>
Newsgroups gnu.bash.bug
Subject Undocumented for-loop construct
Date Thu, 6 Aug 2020 23:50:49 +0200
Lines 30
Approved bug-bash@gnu.org
Message-ID <mailman.1054.1596751404.2739.bug-bash@gnu.org> (permalink)
References <CAGqdar04i1z28vYUFuGr=7WZOUsar8JE+QW0TAm1bnP0+DtEjQ@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1596751405 18920 209.51.188.17 (6 Aug 2020 22:03:25 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=rZaNiCQLcKRgyXVDe7XgzOnIyCRo1ki2NMkHKN92Qx4=; b=GP5IGldMMSK/hofow7dexSPTLGFE3jAjvrrPWyR6nbbI9LHPygBgvjTGQt42puJNYC V0d9Lbh4m/7CV/Ial8oxbyFesfOcbGUgEFYPEwC190hJtYHYN4jdriKfcVokNRMtQaF0 BNHl8GWkuUAVgglYEhB/rLWDxMGIyZtCGlsVDEotA5AiPOBjs/+xTz+KmiTndP+Weq2B DF+nzMFxkcvpWsCZPKNfqebQpbBoUL2ataU4Wr3uLUCeedshbCvoVEvSQbAOXESw9irE kQRxeeA4M3GpC/iAxfWKviwp0rHzV3CoEvaCYlq+pbfj5il00+AwyJQ9E1Bn9b3cbElv z+fw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=rZaNiCQLcKRgyXVDe7XgzOnIyCRo1ki2NMkHKN92Qx4=; b=mJbuKi6GfoyLIFjPIoNor4YAwpBZfN7EutlHHadB08TTlUuEX7CQhqroEiML20WvPU MsejmLWpjoL72kEetYF0nHCXVWQF+bU9f53p9shOG7zQ6Itr4gteDZUfISFSrLkpuaLT MYBrkytGQZyjvvfiyKeW/T6TOA17qOQeTeBmYxt1o75aD3B63bnyuxxhRignAEKhPYpq XiHS5MgQzYon6kMy2VlBgty0IzzsF04uWPGTiAYH7Cm/ulqoHvYXrZ+o9Ia3+Wls827A 7Ld7cvovPYh2I8/Yf+7ZqsAgiEUXLYU5NvHuo7cnLA+VD4ePUB7eSRf6sHTCRCShSkGC 65MA==
X-Gm-Message-State AOAM530pmQUxtlB3KR24zR6GaywJ9ktY5BLmqYo//sgM/qZEPB74AEbS Rgb0wb23u8+2q84AvC5uqy/96G3AAthNXyG9BhGYK6MjvIw=
X-Google-Smtp-Source ABdhPJz8DnBpggB2qcMwEiO4Zxye8wsaftdFyYYIRNjnv+pGTVGkMo3AcPsQ/sRu2GjRjwOkPDO2+b9UQRD2dt2AcAQ=
X-Received by 2002:a50:ba8c:: with SMTP id x12mr6212830ede.319.1596750660332; Thu, 06 Aug 2020 14:51:00 -0700 (PDT)
Received-SPF pass client-ip=2a00:1450:4864:20::532; envelope-from=klaas.vantournhout@gmail.com; helo=mail-ed1-x532.google.com
X-detected-operating-system by eggs.gnu.org: No matching host in p0f cache. That's all we know.
X-Spam_score_int -20
X-Spam_score -2.1
X-Spam_bar --
X-Spam_report (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action no action
X-Mailman-Approved-At Thu, 06 Aug 2020 18:03:24 -0400
X-Content-Filtered-By Mailman/MimeDel 2.1.23
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 <CAGqdar04i1z28vYUFuGr=7WZOUsar8JE+QW0TAm1bnP0+DtEjQ@mail.gmail.com>
Xref csiph.com gnu.bash.bug:16728

Show key headers only | View raw


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

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


Thread

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

csiph-web