sed fails with the following error:
sed: -e expression #1, char 72: unterminated `s' command
Here is my script:
#!/bin/bash
OLD="$(cat /etc/fstab | grep /tmp)"
NEW="$(cat /etc/fstab | grep /tmp | sed 's/,noexec//')"
sed "s|$OLD|$NEW|" /etc/fstab
I don't see how it is unterminated, I have 3 | symbols as delimiters and am using double quotes since I have variables in the statement.
I have read many other questions on stack overflow and other blogs that are similar, but none that were using two variables like this.
Edit to show fstab:
LABEL=/boot    /boot    xfs    defaults,nodev,nosuid,noexec    1    2
/dev/mapper/LV_tmp    /tmp    xfs    nodev,noexec    1    2
proc    /proc    proc    defaults    0    0
