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:firstname.lastname@example.org
- file.txt should look like this after running script:#email@example.com
But it is not working, the file stays unchanged.
And if I execute sed -i '/firstname.lastname@example.org
/s/^/#/' file.txt in terminal, It does the job.
Any idea on how to get this work from script?