2025年12月23日(火) 1:05 Koichi Murase <[email protected]>: > > hobbit:~$ declare -A aa="("${kv[@]}")"; declare -p aa > > declare -A aa=([3]="" [a]="half" [two]="and" [2.5]="three" [one]="1" ) > > [...] In > this example, ${kv[@]} is outside the double quoting (because the > first double quotation is « "(" » and the second double quotation is « > ")" »), and then the bare ${kv[@]} is subject to word splitting
I'm sorry. Actually, my explanation above is wrong, because the right-hand side of the assignment for the declare builtin is not a context where word splitting.happens. The word splitting happens because the declare builtin receives the literal '(one 1 two 2 two and a half 2.5 three 3)' and parses it again. Anyway, the current behavior for the latter example is expected in my understanding. -- Koichi
