I\'ve created a bash script that takes a parameter. I want to pass that parameter to sed to replace an existing string with another which is composed of the variable:
Change your code like his,
sed -i -e 's/name="master"/name="'"$variable"'"/g' test
just do like this:
var=apple sed -i "s/pineapple/$"
Variable expansion does not happen within single quotes. Do it in double quotes: