Re: Changing the way bash expands associative array subscripts

2021-04-12 Thread Chet Ramey
On 4/9/21 12:20 PM, Koichi Murase wrote: That said, the fact that you can put 'a[@]' in an indirect variable and get an array expansion out of "${!x}" is completely repulsive to me. Currently, we need to write as «iref='a[$key]'; echo "${!iref}"» so that $key is not expanded until the referenc

Re: Changing the way bash expands associative array subscripts

2021-04-12 Thread Chet Ramey
On 4/6/21 12:46 PM, Koichi Murase wrote: Looking at another thread https://lists.gnu.org/archive/html/bug-bash/2021-04/threads.html#00051, I'm now also interested in how we can handle the indirect expansions for 'a[@]' and the namerefs for 'a[@]': $ declare -A a=(['@']=x [1]=y) $ $ # indirect e

Re: Changing the way bash expands associative array subscripts

2021-04-12 Thread Chet Ramey
On 4/6/21 12:46 PM, Koichi Murase wrote: How about the cases with `test -v a[@]' and `key=@; test -v a[$key]'? By the time test sees its arguments, there is no difference between these two cases. You can do things to differentiate when running the `[[' command, but `test' goes through the enti