I am using the below code for replacing a string inside a shell script.
echo $LINE | sed -e \'s/12345678/\"$replace\"/g\'
but it\'s getting
I had a similar requirement to this but my replace var contained an ampersand. Escaping the ampersand like this solved my problem:
replace="salt & pepper" echo "pass the salt" | sed "s/salt/${replace/&/\&}/g"