Quote:
Originally Posted by anbu23
Use double quotes
Code:
str=`sed -e "s/orig_string/${var}/g" ${sourcefile}`
|
Also, if var is a path, then you'll need to use '\' before '/'.
Sed substitutes first and then you still need to make sure you escape special characters such as '/'
Eg
set var="\/mydir\/path"
echo "my file /work/kofeyok/stuff/file.dat, r );" > testfile
sed -e "s/\/work\/kofeyok\/stuff/${var}/g" testfile > temp
temp should have
"my file /mydir/path/file.dat, r );"
without double quotes