On 3/7/25 9:23 AM, John Wiersba via Bug reports for the GNU Bourne Again SHell wrote:
In all versions of bash since 2001 (e.g. 5.1.16(1)-release), the following syntax 
works but is not documented:$ for (( i=0; i<3; ++i )) { echo $i; }
0
1
2

The group command as loop body syntax only exists for compatibility with
historical versions of the Bourne shell (where it is likewise
undocumented). Its use is not encouraged, and POSIX doesn't specify it,
so it's not portable.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

  • Bug: please do... John Wiersba via Bug reports for the GNU Bourne Again SHell
    • Re: Bug: ... Chet Ramey
      • Re: B... John Wiersba via Bug reports for the GNU Bourne Again SHell
        • R... Greg Wooledge
          • ... John Wiersba via Bug reports for the GNU Bourne Again SHell
        • R... Lawrence Velázquez
        • R... Chet Ramey
          • ... John Wiersba via Bug reports for the GNU Bourne Again SHell
            • ... Chet Ramey
              • ... John Wiersba via Bug reports for the GNU Bourne Again SHell
                • ... Oğuz
                • ... Martin D Kealey

Reply via email to