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 ?
declare -n ref=b_ABC; ref=DEF; echo "$ref"
(or indirect expansion with${!varname}
) – ilkkachu Sep 07 '22 at 19:01echo
??
– Jaivardhan Sep 07 '22 at 19:12