Hi
I use :
path=/var/www/admin
echo "$path" | sed -e 's/\//\\\//g'
this return
\/var\/www\/admin
and is ok.
but
path2=`echo "$path" | sed -e 's/\//\\\//g'`
echo $path2
return an error:
sed: -e expression #1, char 9: unknown option to `s'
Can anyone help me?
Thanks
kato
2
path2=$(echo "$path" | sed -e 's/\//\\\//g')
Thank you very much.
It's perfect.
ctsgnb
4
You could save some backslash ( and avoid escaping the slash) by choosing another delimiter :
for example :
# echo "$PWD" | sed 's:/:\\/:g'
or
# echo "$PWD" | sed 's;/;\\/;g'