Indirect reference to array values in bash
<p>I am trying to do an indirect reference to values in an array in bash.</p>

<pre><code>anotherArray=("foo" "faa")

foo=("bar" "baz")
faa=("test1" "test2")


for indirect in ${anotherArray[@]}
do

echo ${!indirect[0]}
echo ${!indirect[1]}

done
</code></pre>

<p>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. </p>