Re: parser bug in Q_ARITH

2025-06-30 Thread Zachary Santer
On Mon, Jun 30, 2025 at 1:45 PM Robert Elz wrote: > > What's more, I don't see what the issue is, inside (( )) or $(( )) > is what should be treated as a double quoted string (arith context > for evaluation, but still a double quoted string - and the first thing > the shell should be doing with an

Re: parser bug in Q_ARITH

2025-06-30 Thread Isabella Bosia
for context, this came up when trying to do $((foo[bar[i%${#bar[@]}]])) which has no immediate equivalent without $ On Mon, Jun 30, 2025, 19:45 Robert Elz wrote: > Date:Mon, 30 Jun 2025 10:44:24 -0400 > From:Greg Wooledge > Message-ID: <20250630144424.gj32...@wooled

Re: parser bug in Q_ARITH

2025-06-30 Thread Robert Elz
Date:Mon, 30 Jun 2025 10:44:24 -0400 From:Greg Wooledge Message-ID: <20250630144424.gj32...@wooledge.org> | Unfortunately, that's not true. You need $ if you want to use any | special parameters in an arithmetic context, such as $# or $1. There are a zillion oth

Re: parser bug in Q_ARITH

2025-06-30 Thread Zachary Santer
On Mon, Jun 30, 2025 at 10:45 AM Greg Wooledge wrote: > > On Mon, Jun 30, 2025 at 08:33:49 -0600, Stan Marsh wrote: > > It seems to me that there is never any need for $ in arithmetic contexts, > > so the > > obvious fix would be to just remove any $ found between (( and )). But > > from what I

Re: parser bug in Q_ARITH

2025-06-30 Thread Stan Marsh
(I wrote): >> It seems to me that there is never any need for $ in arithmetic contexts, so >> the >> obvious fix would be to just remove any $ found between (( and )). But from >> what I >> understand that is easier said than done. (Causing Greg to write): >Unfortunately, that's not true. Yo

Re: Typo in Bash Reference Manual

2025-06-30 Thread Stan Marsh
(I wrote): >> https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_06_02 >> I don't read POSIX specs. I have people who read POSIX specs. (And Chet wrote): > Consider asking them first. They're your people, after all. Good one! Well done.

Re: parser bug in Q_ARITH

2025-06-30 Thread Greg Wooledge
On Mon, Jun 30, 2025 at 08:33:49 -0600, Stan Marsh wrote: > It seems to me that there is never any need for $ in arithmetic contexts, so > the > obvious fix would be to just remove any $ found between (( and )). But from > what I > understand that is easier said than done. Unfortunately, that's

Re: parser bug in Q_ARITH

2025-06-30 Thread Stan Marsh
On 6/30/25 5:06 AM, Isabella Bosia wrote: >>this causes a parser error since commit 35bc7025 >>a=(0 1 2) >>b=(0 1 2) >>x=0 >>((i=$x,a[b[i]])) >>using $ anywhere in (( )) makes subscripts not expandable (And then Chet wrote): >This was one of the results of this 2021 discussion: >https://lis

Re: Typo in Bash Reference Manual

2025-06-30 Thread Chet Ramey
On 6/30/25 10:20 AM, Stan Marsh wrote: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_06_02 I don't read POSIX specs. I have people who read POSIX specs. Consider asking them first. They're your people, after all. -- ``The lyf so short, the craft so long

Re: Typo in Bash Reference Manual

2025-06-30 Thread Stan Marsh
(I wrote): >> I always thought the "colon-free" versions of the P.E. was a bash-ism, but >> experimentation shows that it works in "dash" as well. And "man dash" >> contains >> the following text: >> In the parameter expansions shown previously, use of the colon in the >> format >> results

Re: parser bug in Q_ARITH

2025-06-30 Thread Chet Ramey
On 6/30/25 5:06 AM, Isabella Bosia wrote: this causes a parser error since commit 35bc7025 a=(0 1 2) b=(0 1 2) x=0 ((i=$x,a[b[i]])) using $ anywhere in (( )) makes subscripts not expandable This was one of the results of this 2021 discussion: https://lists.gnu.org/archive/html/bug-bash/2021-

Re: Typo in Bash Reference Manual

2025-06-30 Thread Chet Ramey
On 6/29/25 10:13 AM, Stan Marsh wrote: I always thought the "colon-free" versions of the P.E. was a bash-ism, but experimentation shows that it works in "dash" as well. And "man dash" contains the following text: In the parameter expansions shown previously, use of the colon in the format

parser bug in Q_ARITH

2025-06-30 Thread Isabella Bosia
this causes a parser error since commit 35bc7025 a=(0 1 2) b=(0 1 2) x=0 ((i=$x,a[b[i]])) using $ anywhere in (( )) makes subscripts not expandable