16 lines
No EOL
442 B
Text
16 lines
No EOL
442 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:-Server: $HOST - 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" |