zsh-settings/.confirm_reboot

16 lines
No EOL
426 B
Text

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