Re: Behaviour of test -v with assoc array and quote character in key

2021-02-15 Thread Daniel Gröber
Hi Greg and Chet, On Mon, Feb 15, 2021 at 08:48:15AM -0500, Greg Wooledge wrote: > Do it this way instead: > > unicorn:~$ mytest() { array[$1]=123; test -v 'array[$1]'; echo "$?"; } Ah! I didn't know test would exand that '$1' in there, cool. > Yours expands $1 first, then passes array["] as an

Behaviour of test -v with assoc array and quote character in key

2021-02-14 Thread Daniel Gröber
Hi list, I've found what I belive to be a bug in how `test -v` expands the key in an associative array. The following minimal test case demonstrates the problem: declare -A array mytest () { array["$1"]=123 test -v array["$1"] printf 'test -v array