I have the following Problem, I need an environment variable that contains globbing characters as clear text, and I can't seem to escape them. Escaping with backslash works, but for some reason the backslash is still part of the string."
Disabling GLOB_SUBST resolves the problem, but I´d like to avoid that.
I used the following to narrow down the problem:
touch foo; chmod +x ./foo
glob expansion i.E. $test contains all files in the directory.
echo 'export test="*"; echo $test' > foo; source ./foo
no glob expansion, but the escape character is added to the string.
echo 'export test="*"; echo $test' > foo; source ./foo
output: *
Any help would be appreciated.
test
variable"$test"
? – Inian Dec 12 '21 at 15:10noglob echo $test
. – Kusalananda Dec 12 '21 at 18:06