I've written a script that sources a bash shell fragment. The shell fragment is supposed to be a kind of configuration file, basically it's a bunch of bash variable.
The issue here is when some of those string variable contain characters that should be escaped. As they aren't escape, the script might faill later on or have undesired behavior.
At the moment, my script is validating the shell fragment (the configuration file) bash syntax (
bash -n) but if any charachter is to be escaped, that won't be detected.
So, I would like either to auto-escape sensitive character or, at least, detect their are some so I can display an error and exit.
Any idea how could I achieve that?