bash - How do I assign a list to the values of an associative array? -


this trying do: assign list value of associative array.

#!/usr/local/bin/bash declare -a params  params[n]=(200 400 600 800) params[p]=(0.2 0.4) 

but got error:

line 4: params[n]: cannot assign list array member line 5: params[p]: cannot assign list array member 

is there way around problem ?

try this:

params=([n]="200 400 600 800" [p]="0.2 0.4") declare -p params 

output:

 declare -a params='([n]="200 400 600 800" [p]="0.2 0.4" )'