Created
July 30, 2024 18:55
-
-
Save TheBunnyMan123/1117813c46720fc66b1ff8b602a5e09a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
exec 3>&1; | |
result=$(dialog --radiolist "Power Options" 0 0 2>&1 1>&3 5 "Shut Down" 1 "on" "Restart" 2 "off" "Suspend" 3 "off" "Hibernate" 4 "off" "Hybrid Sleep" 5 "off") | |
exec 3>&-; | |
if [[ "$result" = "Shut Down" ]] | |
then | |
systemctl poweroff | |
elif [[ "$result" = "Restart" ]] | |
then | |
systemctl restart | |
elif [[ "$result" = "Suspend" ]] | |
then | |
systemctl suspend | |
elif [[ "$result" = "Hibernate" ]] | |
then | |
systemctl hibernate | |
elif [[ "$result" = "Hybrid Sleep" ]] | |
then | |
systemctl hybrid-sleep | |
else | |
clear | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment