Hi,
I want to interpolate variable in a bash string variable. But the
following code shows the spaces are not maintained. There is some
built-in features in perl to do string interpolation. Does anyone know
the best way to do string interpolation in bash? Thanks.
~$ cat main.sh
#!/usr/bin/env bash
x=ABC
y=IJK
z=XYZ
str='$x $y $z'
eval echo "$str"
~$ ./main.sh
ABC IJK XYZ
--
Regards,
Peng