Issue
This is basically what I am trying to do: to assign a list to the value of an associative array.
#!/usr/local/bin/bash
declare -A params
params[n]=(200 400 600 800)
params[p]=(0.2 0.4)
But I got this error:
line 4: params[n]: cannot assign list to array member
line 5: params[p]: cannot assign list to array member
Is there any way to get around this problem ?
Solution
Try this:
declare -A params
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" )'
Answered By - Cyrus Answer Checked By - Gilberto Lyons (WPSolving Admin)