a=1
b=2
c=3
for db in $a $b $c; do
echo VARIABLE NAME
blah
blah
blah
I need this for a script I am writing. I have some Client names set at the top to database names for the varialble. I am running a ps -ef and a few other things, but I need it to echo out which client name it is on in the loop. So in example above, it would echo out "a", then its other commands, then on the second loop echo "b" .....etc
Use variable indirection:
for var in a b c ; do
echo $var ${!var}
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With