lundi 29 juin 2015

bash if statement issue

Would someone mind giving me a hand with the following IF Statement?

read -e -p "Would you like to reboot now?: " -i " " REBOOT

if $REBOOT = 'yes' ; then
   echo 'System will now reboot'
   shutdown -r now
else $REBOOT != 'yes'
   echo 'You have chosen to reboot later'
fi

If I enter 'yes' I get the following as an endless result

= yes
= yes
= yes
...
= yes

And if I enter 'no' I get the following:

./test.sh: line 7: no: command not found
./test.sh: line 10: no: command not found
You have chosen to reboot later

Any ideas?

Aucun commentaire:

Enregistrer un commentaire