I have two bash variables, one called GREP_ENTRY, which contains a long string:
GRUB_CMDLINE_LINUX="crashkernel=auto spectre_v2=retpoline rd.lvm.lv=d6c-2b-59-93-97-ea/lv_root rhgb quiet console=tty0
and the other is called NEW_ENTRY, which is the exact same as GREP_ENTRY but with fips=1 appended to the end:
GRUB_CMDLINE_LINUX="crashkernel=auto spectre_v2=retpoline rd.lvm.lv=d6c-2b-59-93-97-ea/lv_root rhgb quiet console=tty0 fips=1
I am trying to use sed to find GREP_ENTRY in /etc/default/grub and replace it with NEW_ENTRY. Currently, I am trying to use double quotes as follows:
sed -i "s/$GREP_ENTRY/$NEW_ENTRY/g" /etc/default/grub
But I get the error:
sed: -e expression #1, char 123: unknown option to `s'
I have tried using other combinations of double quotes but to no avail. Can someone explain how I can properly use sed in this situation?