Situation:
echo "tell me a word"
read the_word
How to replace all WordToReplace in a file by the_word?
sed does not seems to appreciate:
sed -i 's/WordToReplace/$the_word/g' thefile.sh
Situation:
echo "tell me a word"
read the_word
How to replace all WordToReplace in a file by the_word?
sed does not seems to appreciate:
sed -i 's/WordToReplace/$the_word/g' thefile.sh
Variables are not expanded within single quotes, they are treated literally then.
Use double quotes instead:
sed -i "s/WordToReplace/$the_word/g" thefile.sh