I am writing a script in bash and I can remove a string from a sentence using the code below:
echo 'This is a foo test' | sed 's/\<foo\>//g'
OUTPUT: 'This is a test'
However, I want to be able to replace the foo with a variable. I tried the command below but it does not remove the values from the sentence.
temp="foo"
echo 'This is a foo test' | sed 's/\<$temp\>//g'
OUTPUT: 'This is a foo test'