On Wed, Jul 9, 2025 at 11:38 AM Chet Ramey <[email protected]> wrote:
>
> If the expression hadn't contained $x, nothing would have been expanded,
> because expanding a word without any expansion characters is a waste of
> time. This arguably causes a problem in this case; it would have been
> more consistent to run the whole string through word expansion and quote
> the subscript in all cases.
By the same token, if quoting the subscript by placing backslashes in
front of [ and ] is unnecessary without a $ somewhere else in the
expression, why would it be necessary with one? What is there to be
expanded more than once without a $?
Why can't a[b[i]] within an arithmetic context work just like
a[b[i]]='whatever' or ${a[b[i]]} outside of one?