diff --git a/.confirm_reboot b/.confirm_reboot new file mode 100644 index 0000000..77a0b44 --- /dev/null +++ b/.confirm_reboot @@ -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" \ No newline at end of file