Originally Posted by
andru183
no but if they ask for status to see if its on or not i wanted the shell to show the status, i thought the shell wouldn't close till the user either pressed ctrl-z or enter, didnt know it required something to stay open while it showed the status
With this code, it will keep going until they type "quit". If you want it to exit after any of the options, just add exit or break to said option.
Code:
#!/bin/bash
echo 'Your chance to turn your fire wall on/off or check status
================================================== ========================
Please type on/off or status'
while true; do
read x
case "$x" in
on)
sudo ufw -enable
;;
off)
sudo ufw -disable
;;
status)
sudo ufw -status
;;
quit)
echo "Bye!"
exit
;;
*)
echo "Invalid option"
;;
esac
done
Bookmarks