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
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
pls put your comment
ReplyDeletenice work in Linux
ReplyDeleteYou can find some more detailed about echo command in linux here below :
ReplyDeletehttps://www.linuxteck.com/basic-echo-command-in-linux-with-examples/
This comment has been removed by the author.
ReplyDelete