confirm reboot function
This commit is contained in:
parent
1203008b7c
commit
ae99c5b75b
1 changed files with 16 additions and 0 deletions
16
.confirm_reboot
Normal file
16
.confirm_reboot
Normal 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"
|
Loading…
Reference in a new issue