basic case script

this  will ask you for the restart or shutdown you linux machine 

vim shut.sh
#!/bin/bash
echo "hello $USER."
echo "what you wants form me."
echo "press \"r\" to restart server"
echo "press \"s\" to shutdown the server"
echo "prss any other key to exit."
read -p "pls give your option: " t
case $t in
    r)
        reboot
    ;;
    s)
        poweroff
    ;;
    *)
        echo "invalid option."
    ;;
esac