Nope, I don't really understand. What do you expect the value of ${SERVER}_${SERVICE} should be?
I try to guess at this point: you have an array which store the names of the servers ($SERVERS) and three arrays which store the name of the services for each server ($SERVER1_SERV, $SERVER2_SERV, $SERVER3_SERV). So you want to loop over the servers names (SERVER1 SERVER2 SERVER3) to get the corresponding services names, right?
If this is the case, you have to use "indirect reference" to build the name of the three service variables and then loop over them:
Code:
#!/bin/bash
SERVERS=(SERVER1 SERVER2 SERVER3)
SERVER1_SERV=(web ftp mail)
SERVER2_SERV=(web transcoding)
SERVER3_SERV=(web ftp mail)
for SERVER in ${SERVERS[@]}
do
echo "Starting tranfer for server $SERVER"
for i in $(eval echo \${${SERVER}_SERV[@]})
do
echo $i
done
done
Note the construct of eval echo \$. This is indirect variable reference.