I am trying to do the following in my script:
#/bin/bash -x var1=www var2=www2 var3=www3 var4=www4 for i in 1 2 3 4; do echo \$var$i done
Obviously, this doesn't work as expected and results in the following output:
$var1 $var2 $var3 $var4
How can I dynamically reference the variables in my loop?