I\'m trying to create a multidimensional associative array but need some help. I have reviewed the page suggested in this SO answer but it confused me even more. So far here
#!/bin/bash
declare -A PERSONS
declare -A PERSON
PERSON["FNAME"]='John'
PERSON["LNAME"]='Andrew'
PERSONS["1"]=${PERSON[@]}
PERSON["FNAME"]='Elen'
PERSON["LNAME"]='Murray'
PERSONS["2"]=${PERSON[@]}
for KEY in "${!PERSONS[@]}"; do
TMP="${PERSONS["$KEY"]}"
echo "$KEY - $TMP"
**echo "${PERSON["FNAME"]}"
echo "${PERSON["LNAME"]}**"
done
Because the original array for the separate names is still active and it can still be referenced within the for loop.