zsh-settings/.confirm_reboot

16 lines
442 B
Text
Raw Normal View History

2021-12-05 09:45:41 +01:00
### to prevent accidental shudown, add confirm dialog to commands:
confirm() {
# call with a prompt string or use a default
2021-12-05 09:49:48 +01:00
read -r -p "${1:-Server: $HOST - Are you sure? [y/N]} " response
2021-12-05 09:45:41 +01:00
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
alias reboot="confirm && reboot"
alias shutdown="confirm && shutdown"
alias poweroff="confirm && poweroff"