Suppose I have the following 2 variables:
color=black
round_black_car=IGK47546
Is it possible to print IGK47546
with the variable color
?
echo ${round_${color}_car}
doesn't work. It gives me bad substitution
error.
Suppose I have the following 2 variables:
color=black
round_black_car=IGK47546
Is it possible to print IGK47546
with the variable color
?
echo ${round_${color}_car}
doesn't work. It gives me bad substitution
error.
You should use eval expression combine with backslash
to perform the replacement.
$ color=black
$ round_black_car=IGK47546
$ eval echo \${round_${color}_car}
IGK47546