help-bash
[Top][All Lists]
Advanced

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

Re: is there a way to assign indexed arrays like the new assoc arrays wa


From: Lawrence Velázquez
Subject: Re: is there a way to assign indexed arrays like the new assoc arrays way without [..]= typing ?
Date: Fri, 12 Mar 2021 16:44:13 -0500

> On Mar 12, 2021, at 4:39 PM, Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
> 
> so i heard off my good buddy greycat

roflmfao

> that i could assign assoc arrays like
> declare -A assoc=( key1 val1 key2 val2 )
> that was new and nice
> 
> is there such also for indexed arrays, or planned to do ? since it makes
> coding very simpler
> 
> otherwise, i have to parse and reset declare -p output for, ..whatever
> purpose
> mass modifying or so arrays without loop
> 
> with such a way for indexed arrays too such would be much simpler

bash-5.1$ declare -a arr=([3]=foo [7]=bar)
bash-5.1$ declare -p arr
declare -a arr=([3]="foo" [7]="bar")

--
vq


reply via email to

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