I have a number of variables that are being source'd from an external file:
my.sh
source my.conf
sed -i "s:var1:$var1:g" $SOME_FILE
sed -i "s:var2:$var2:g" $SOME_FILE
sed -i "s:var3:$var3:g" $SOME_FILE
my.conf
var1=abc:abc
var2=def!123
var3=&*(!"£
The script that source's these variables will run into issues if any of the values contain special characters (such as the colon character):
I have seen how variables can be individually sanitised, but is it possible to sanitise them all in one go? Note that the actual variable names do not have a pattern as in the example above.