Writing a script where I have several arrays defined and each array contain a list of servers.
array names,
T1 T2 T3 T4 T5
I want to have a for loop go though another for loop containing the array names, then perform actions based on the contects of each one.
Tried this, but doesn't work.
Code:
for ARRAY in T1 T2 T3 T4 T5; do
for SERV in ${$ARRAY[@]}; do
doing stuff...
doing stuff...
done
done
I would expect using ${$ARRAY[@]} would cause the "for SERV" loop to go through each arrays values.
gives an error like this,
line 117: ${$ARRAY[@]}: bad substitution
Can you use a variable name when referencing an array is my question.