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

2025-03-15 Thread Phi Debian
On Mon, Mar 10, 2025 at 5:39 PM Zachary Santer wrote: > > Another alternative would be for bash to print a warning whenever it > encounters this syntax. > Don't do that, the one who don't care about shell portability. i.e the script started with #!/bin/bash may well be using this construct "for

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

2025-03-15 Thread Chet Ramey
On 3/10/25 9:38 AM, John Wiersba wrote: Maybe a comment in the documentation along the lines of:     There are also alternate, deprecated syntactic constructs for these loops     which will not be documented here would serve both aims? How is that better? It leads to the inevitable "well,

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

2025-03-15 Thread Zachary Santer
On Mon, Mar 10, 2025 at 10:54 AM John Wiersba via Bug reports for the GNU Bourne Again SHell wrote: > > 2) However, if the alternate syntax is actively supported, then I think it > *should* be documented, even if it is considered error-prone and if > "best-practice" is to avoid it. > The alterna

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

2025-03-12 Thread Martin D Kealey
On Tue, 11 Mar 2025, 00:54 John Wiersba via Bug reports for the GNU Bourne Again SHell, wrote: > The alternative is to have people, like me, stumbling on this > undocumented syntax and spending a considerable amount of time trying to > explore what it is and why it is undocumented. Hah! That's

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

2025-03-11 Thread Oğuz
On Monday, March 10, 2025, John Wiersba via Bug reports for the GNU Bourne Again SHell wrote: > > The alternative is to have people, like me, stumbling on this > undocumented syntax and spending a considerable amount of time trying to > explore what it is and why it is undocumented. > And how is

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

2025-03-11 Thread John Wiersba via Bug reports for the GNU Bourne Again SHell
I guess we could approach this topic a different way (the statements below are  just my guesses and not based on any particular insight I have into the history  of this syntax): 1) If this alternate syntax is not actively supported, then that could be stated as the reason why it is not (further)

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

2025-03-10 Thread John Wiersba via Bug reports for the GNU Bourne Again SHell
On Monday, March 10, 2025 at 12:38:38 PM EDT, Zachary Santer wrote: > Another alternative would be for bash to print a warning whenever it > encounters this syntax. There are precedents for this kind of behavior in languages like perl which issue warnings for deprecated features for several rel

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

2025-03-10 Thread Lawrence Velázquez
On Mon, Mar 10, 2025, at 12:38 PM, Zachary Santer wrote: > There are other weird, undocumented things that you could have the > same conversation about. ${#@} is equivalent to ${#} This is documented and not at all weird. $# came from Bourne, and ${#@} is a logical extension of ${#var} that happe

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

2025-03-10 Thread John Wiersba via Bug reports for the GNU Bourne Again SHell
Thanks, Chet!   Yes, you're right that zsh definitely does not encourage use of these non-standard constructs. This whole thread got started when I accidentally created a mashup of shell/perl, similar to:      for (( i=0; i<3; ++i )) { echo $i; } and was really quite surprised to find that i

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

2025-03-10 Thread Chet Ramey
On 3/7/25 12:23 PM, John Wiersba wrote: You're discouraging it's use by not documenting it.  BTW, according to those links below, apparently zsh documents it (and encourages its use)? I think "encourages" is a very generous reading of "These are non-standard and are likely not to be obvious ev

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

2025-03-07 Thread Lawrence Velázquez
On Fri, Mar 7, 2025, at 12:23 PM, John Wiersba via Bug reports for the GNU Bourne Again SHell wrote: > You're discouraging it's use by not documenting it. That is the point, I believe. > BTW, according to those links below, apparently zsh documents it This is true. https://zsh.sourceforge.io/D

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

2025-03-07 Thread John Wiersba via Bug reports for the GNU Bourne Again SHell
Thanks, Greg!!! On Friday, March 7, 2025 at 01:19:28 PM EST, Greg Wooledge wrote: On Fri, Mar 07, 2025 at 17:23:57 +, John Wiersba via Bug reports for the GNU Bourne Again SHell wrote: >    - Is our conversation being recorded somewhere in the gnu archives, so >that I can link to

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

2025-03-07 Thread Greg Wooledge
On Fri, Mar 07, 2025 at 17:23:57 +, John Wiersba via Bug reports for the GNU Bourne Again SHell wrote: >- 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.

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

2025-03-07 Thread John Wiersba via Bug reports for the GNU Bourne Again SHell
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?

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

2025-03-07 Thread Chet Ramey
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

Bug: please document extended and alternate for loop syntax

2025-03-07 Thread John Wiersba via Bug reports for the GNU Bourne Again SHell
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 manpage only lists this syntax: for (( expr1 ; expr2 ; expr3 )) ; do list ; done$ bash --version | head -1 # on a Dell desktop, linux