confirm reboot function

This commit is contained in:
Elmar Sönser 2021-12-05 09:45:41 +01:00
parent 1203008b7c
commit ae99c5b75b

16
.confirm_reboot Normal file
View file

@ -0,0 +1,16 @@
### 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"