zsh-settings/.confirm_reboot

16 lines
426 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
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"