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: John Wiersba
Subject: Re: Bug: please document extended and alternate for loop syntax
Date: Fri, 7 Mar 2025 17:23:57 +0000 (UTC)

 Thanks for your reply, Chet!  

You're discouraging it's use by not documenting it.  BTW, according to those 
links below, apparently zsh documents it (and encourages its use)? 
Two questions: 
   
   - Is there a link to some page where you document 
obsolete/discouraged/deprecated constructs?
   - Is our conversation being recorded somewhere in the gnu archives, so that 
I can link to it in my stackoverflow question?  Otherwise, I'll just clip 
quotes from it to paste there.
-- John
    On Friday, March 7, 2025 at 12:03:18 PM EST, Chet Ramey 
<chet.ramey@case.edu> wrote:  
 
 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/
  

reply via email to

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