I'm having a problem with a script. It is meant to change a value in a file called %DIR%
so that it becomes a path name. The problem is the slashes in the directory name upset sed, so I get weird errors. I need to convert the slashes in the path name into escaped slashes.
So /var/www
would become \/var\/www
But I don't know how to do this.
Currently the script runs sed with this:
sed -i "s/%DIR%/$directory/g" "$config"
delim=$(printf '\001') ; sed -e "s${delim}regexp${delim}replacement${delim}"
. It doesn't have to be different from everything sed SEES but from everything is at "regexp" and "replacement" ... which is usually printable characters and regexps – Olivier Dulac Oct 01 '18 at 13:34