Shell Array of Arrays

#!/bin/sh
array="aaa bbb ccc"
array2="aaa1 bbb1 ccc1"
test="\$array \$array2"

for i in ${test}
do
        for j in `eval echo  "$i"`
        do
                echo $j
        done
done

Out:

aaa
bbb
ccc
aaa1
bbb1
ccc1

Comments are closed.