I have a variable that contains a line like this:
var='$FOO/bar/baz*'
and I want to replace the $ FOO variable with its contents. However when i do
var=$(eval "echo $var")
This variable is replaced, but the star is also replaced so that it varnow contains all possible matches in my file system (as if I clicked a tab in the shell). for example, if $ FOO contains / home, it varwill contain"/home/bar/baz1.sh /home/bar/baz2.sh /home/bar/baz.conf"
How to replace a variable without wildcard expansion?
source
share