This question already has an answer here:
Suppose i have the following:
foo1=abc
i=1
a="FOO${i}"
echo ${${a}}
echo ${`echo $a`} # I also tried that
I am getting the error bash: ${${a}}: bad substitution
.
Thanks
This question already has an answer here: Suppose i have the following:
I am getting the error Thanks |
|||||
marked as duplicate by don_crissti, maxschlepzig, Archemar, Jeff Schaller, Stephen Kitt 2 days agoThis question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. |
|||||
|
You can use parameter indirection
From "Parameter Expansion" section of
|
|||
|
You can use
To illustrate:
produces (call the script "foo"):
|
|||||
|