I read all the similar questions on this topic, but did not find a suitable question for what I am experiencing. We apologize if this has already been answered.
Inside the bash script I wrote, there is a very simple sed command that doesn't seem to work. There are no errors, and the command works great when run from the command line.
In the output from set -x, I see that the sed command runs fine.
GNU bash version 4.3.11 (1) -release (x86_64-pc-linux-gnu)
Bash script: (softened for easier understanding)
#!/bin/bash -x # This script has the exact same sed command as used on cli contact='" tim@email.com "' sed -i "/$contact/d" /home/tim/Desktop/file.txt exit
Shell Output:
tim@ubuntu :~/Desktop$ cat file.txt t,b, tim@email.com tim@ubuntu :~/Desktop$ ./test.sh + contact='" tim@email.com "' + sed -i '/" tim@email.com "/d' /home/tim/Desktop/file.txt + exit tim@ubuntu :~/Desktop$ cat file.txt t,b, tim@email.com tim@ubuntu :~/Desktop$ sed -i "/" tim@email.com "/d" /home/tim/Desktop/file.txt tim@ubuntu :~/Desktop$ cat file.txt tim@ubuntu :~/Desktop$
I suppose I am missing something very obvious, but I look at him completely, hoping for an answer to jump off the screen and hit me in the face. Please, help: -)
Tim
source share