linux - Echo variable name, not value, from for loop in bash? -
a=1 b=2 c=3 db in $a $b $c; echo variable name blah blah blah
i need script writing. have client names set @ top database names varialble. running ps -ef , few other things, need echo out client name on in loop. in example above, echo out "a", other commands, on second loop echo "b" .....etc
use variable indirection:
for var in b c ; echo $var ${!var} done
Comments
Post a Comment