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