I have a command that sets an environment variable from a command like this:
BLACKLIST=$(python tools.py gen-blacklist)
Which results in a string that contains dots *
and asterisks *
, like this:
LISTEN,UNLISTEN,NOTIFY,SHOW,REFRESH,pg_notify,.*remove,.*delete,.*update,.*create,.*insert
I want to be able to escape all the dots and asterisks in the string, this is what I have tried:
TEMP=$(python tools.py gen-blacklist) && BLACKLIST=$(echo ${TEMP/.\*/\\.\\*}) && echo $BLACKLIST
but it only replaces at the first occurence.
LISTEN,UNLISTEN,NOTIFY,SHOW,REFRESH,pg_notify,\.\*remove,.*delete,.*update,.*create,.*insert
How do I escape for all occurences of *
and .
?