Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
uname output: Linux exercism-vm 5.15.0-50-generic #56-Ubuntu SMP Tue Sep 20
13:23:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
On 2020-12-15 16:58, Chet Ramey wrote:
> On 12/15/20 11:23 AM, Glenn Jackman wrote:
> > I would think that these pairs of invocations would correspond:
> >
> > declare -A v1=$( $foo 3 )
> > declare -A v1=$( [1]=2 [3]="")
> >
> > d
uot; )
There's a workaround using `eval` and shell-quoted transformation,
but ... yuck:
$ eval assoc=( "${CSV[@]@Q}" )
$ declare -p assoc
declare -A assoc=([foo]="bar" [baz]="hello world" )
Particularly when this same technique works for indexed arrays: this results in
a copy of the CSV array, not a new array with only a single element:
declare -a copy
copy=("${CSV[@]}")
--
Glenn Jackman
Write a wise saying and your name will live forever. -- Anonymous