I am trying to make a bash script, really simple one, that comments out any line in file.txt that contains user input value, in my case email address.
The script looks like this:
echo Unblock email account:
sed -i '/$email/s/^/#/' file.txt
- file.txt before running script:email@example.com
- file.txt should look like this after running script:#firstname.lastname@example.org
But it is not working, the file stays unchanged.
And if I execute sed -i '/email@example.com
/s/^/#/' file.txt in terminal, It does the job.
Any idea on how to get this work from script?