tags:

views:

203

answers:

2

Hi, 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.

+1  A: 

I would use simple quote and see if it's help:

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

or with a variable:

echo $passwordVar' --md5 password-converted-to-md5' >> /boot/grub/grub.conf
RC
+2  A: 

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

knittl
You were right, thank you - I'd written the script using MS notepad and for some reason the first hyphen was displayed fine in notepad but as an accented 'u' in nano - lovely old MS eh! thanks again chaps.
Chopper3