I am trying to do an indirect reference to values in an array in bash.
anotherArray=("foo" "faa")
foo=("bar" "baz")
faa=("test1" "test2")
for indirect in ${anotherArray[@]}
do
echo ${!indirect[0]}
echo ${!indirect[1]}
done
This does not work. I tried a lot of differenct things to get the different values of $foo by echoing $indirect but I can only get the first value, all values, '0' or nothing at all.