bug-bash
[Top][All Lists]
Advanced

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

Re: Bug: please document extended and alternate for loop syntax


From: Chet Ramey
Subject: Re: Bug: please document extended and alternate for loop syntax
Date: Fri, 7 Mar 2025 12:03:06 -0500
User-agent: Mozilla Thunderbird

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    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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