I'm learning how bash scripting and I need to know how to get a value from an array of dictionaries. I did this for the declaration:
declare -a persons
declare -A person
person[name]="Bob"
person[id]=12
persons[0]=$person
If I do the following it works fine:
echo ${person[name]}
# Bob
But when I try to access to the values from the array it doesn't work. I tried these options:
echo ${persons[0]}
# empty result
echo ${persons[0][name]}
# empty result
echo persons[0]["name"]
# persons[0][name]
echo ${${persons[0]}[name]} #It could have worked if this work as a return
# Error
And I dont know what more try. Any help would be appreciated!
Thank you for reading!
Bash version: 4.3.48
perl,php,pythonetc.curl.