I am in the process of writing a script to change the grub password in the grub.conf file. I thought I had it figured out, but am running into an a problem I can't put my finger on.
Command I am running when I find that the grub.conf file contains "password --md5".
sed "s=password.*=password --md5 "$grubPW"=g" /boot/grub/grub.conf
If I run it from the shell prompt it works as expected, but when I put it into my script it doesn't replace the search string, it does add the replacement string though.
I switched the traditional '/'s to "="s because the hashed password will sometimes contain slashes.
Expected Result:
password --md5 $1$5fKefK.fw/FeMM4d2D
Actual Result:
password --md5 $1$5fKefK.fw/FeMM4d2D
password --md5
I should just end up with the one line containing the hash value.