I'm trying to use sed to replace some directories over a file. This is how I'm using the sed to replace.
sed -i "s/location_apache/$CUSTOM_INSTALL_HOME/g" $apache_boing
Now, the problem comes with the $CUSTOM_INSTALL_HOME
variable. Because is a directory.
Every time I tried to run the script I got this error.
sed: -e expression #1, char 22: unknown option to `s'
I know this is because the missing \ on the $CUSTOM_INSTALL_HOME
variable
There is any workaround for this issue?
Thanks
Since $CUSTOM_INSTALL_HOME
has forward slash /
you can use a different delimiter like hash #
in sed:
sed -i "s#location_apache#$CUSTOM_INSTALL_HOME#g" $apache_boing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With