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.
/var/www would become
But I don't know how to do this.
Currently the script runs sed with this:
sed -i "s/%DIR%/$directory/g" "$config"