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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -