bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "${assoc[@]@k}" doesn't get expanded to separate words within compou


From: Zachary Santer
Subject: Re: "${assoc[@]@k}" doesn't get expanded to separate words within compound assignment syntax
Date: Wed, 20 Mar 2024 07:11:34 -0400

On Wed, Mar 20, 2024 at 12:29 AM Lawrence Velázquez <vq@larryv.me> wrote:
>
> 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

There I go, reporting a bug that isn't a bug again.

One would think that enabling this behavior would be the entire
purpose of the alternate ( key value ) syntax. If it doesn't do that,
what benefit does it give over the standard ( [key]=value ) syntax?
Maybe it;s easier to use eval with?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]