2

I hope the question makes sense, I would like to do something like:

a=test
b=a
echo ${$b} # should echo test

Basically I'd like $b to expand to the value a and have bash echo out the value of variable $a (since ${a} is test).

What syntax should I use?

Andreas Wong
  • 59,630
  • 19
  • 106
  • 123

1 Answers1

3
a=test
b=a
echo ${!b} # does echo test
bobah
  • 18,364
  • 2
  • 37
  • 70