0

I am trying to do something like below :

export a="ABC"  # Works fine
export b_"$a"="DEF"  # Works fine

Now how do I print or echo the new variable "b_$a" ??

I tried :

  • echo ${b_$a}
  • echo ${b_"$a"}

etc, and many more combinations like this. But none of them is working.

All I am getting is the error :

-bash: ${b_$a}: bad substitution

Any idea, how can I achieve this ?

ilkkachu
  • 138,973

0 Answers0