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: Lawrence Velázquez
Subject: Re: "${assoc[@]@k}" doesn't get expanded to separate words within compound assignment syntax
Date: Wed, 20 Mar 2024 09:32:35 -0400
User-agent: Cyrus-JMAP/3.11.0-alpha0-332-gdeb4194079-fm-20240319.002-gdeb41940

On Wed, Mar 20, 2024, at 7:11 AM, Zachary Santer wrote:
> 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?

https://lists.gnu.org/archive/html/bug-bash/2019-07/msg00056.html

-- 
vq



reply via email to

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