Thursday, March 17, 2022

[SOLVED] echo in a bash script changing '--md5' to '?-md5'

Issue

I'm writing a VMWare ESX automated build script and I'm falling at the last hurdle, probably as I'm really not strong at scripting.

I need to secure Grub so in my script I have a like saying;

echo "password --md5 password-converted-to-md5" >> /boot/grub/grub.conf

This unfortunately places the following into this file;

password ?-md5 password-converted-to-md5

I know it's a simple one for some of you guys but I've been googling for hours and I'm getting frustrated.

Thank you very much in advance.


Solution

make sure you have simple ascii dashes and not other chars like non-breaking-hyphen, mathematical-minus, en-dash, em-dash, etc. best is to just re-type your line, this will hopefully solve your problem



Answered By - knittl
Answer Checked By - Robin (WPSolving Admin)