sed
I am trying to replace the default path in a file(which is a script)
with the new path which I have get when the bash script runs
The code is
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
sed -i "s/$HomeDir/$SCRIPTPATH/g" <filename>
where $HomeDir=/default/path
I get the following error
sed: -e expression #1, char 8: unknown option to `s'
I have tried various alternates mentioned on the forum but nothing works. I know the backslash in the path name needs to be escaped but I obtain the SCRIPTPATH as a variable during runtime.
Is there a way out?
Any help will be much appreciated.
Thanks,
|