On Tue, Mar 19, 2024, at 11:18 PM, Zachary Santer wrote: > As such, I would expect that > $ declare -A assoc_2=( "${assoc_1[@]@k}" ) > would create assoc_2 as a duplicate of assoc_1. However, we see that > the entire expansion becomes the key for a single array element, with > its value being the empty string.
This isn't specific to ${var[@]@k}. $ kv1='a 1 b 2 c 3' $ kv2=(a 1 b 2 c 3) $ declare -A aa1=($kv1) aa2=(${kv2[@]}) aa3=("${kv2[@]}") $ declare -p aa1 aa2 aa3 declare -A aa1=(["a 1 b 2 c 3"]="" ) declare -A aa2=(["a 1 b 2 c 3"]="" ) declare -A aa3=(["a 1 b 2 c 3"]="" ) A couple of previous discussions: - https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00066.html - https://lists.gnu.org/archive/html/bug-bash/2023-06/msg00128.html -- vq