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://lists.gnu.org/archive/html/bug-bash/2021-03/msg00056.html Strange, because that thread seems to be mostly about associative arrays and there are no associative arrays in Isabella's example. (**) >You can get the result you want by not using the $. Well, yes, there are always workarounds, but that's not really the point. The point is that it *is* a bug (*). It seems like a bug that can't be fixed, from what I understand about the bash architecture. But a bug nonetheless. 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. Note, BTW, that "shellcheck" would catch and diagnose this issue - it warns when you use $ where you don't need it. (*) And that is the point of this list, right? - to report and discuss bugs. (**) Note, incidentally, that there really are two kinds of arrays in bash. In AWK, all arrays are associative (subscripted by strings), even though we often pretend that there are numerically-subscripted arrays.