I have a variable containing wildarded file descriptors:
FORMATS='*.mobi *.pdf *.txt *.epub *.lit'
It gets expanded with the appropriate files if I write
echo $FORMATS
and retains its string value if i quote it
echo "$FORMATS"
Now, I need to manipulate it as a string and I do this.
SUBST=`echo "$FORMATS" | sed "s/$1//"`
The problem is that within “ the files get expanded anyway. How to prevent this? Thanks.
No, it doesn’t get expanded!
What you are probably doing is using
SUBSTwithout quotes (eg:echo $SUBST) and then it gets expanded… use"$SUBST".