#!/bin/sh echo "You are about to run the command '$*' on `hostname`." >&2 echo -n "Are you sure this is what you want to do? (Y/N): [N] " >&2 read x || exit case "$x" in [Yy]*) exec "$@" ;; *) echo "Command '$*' aborted." >&2 ; exit 1 ;; esacNow, on my servers I add these aliases to root’s .bashrc file:
alias halt=’confirm halt’; alias reboot=’confirm reboot’That’s saved me a few times since then. The .bashrc file also already had the “alias rm=’rm -i’” in there, which at first I hated, but learned to like it after it too saved my skin on more than one occasion.
@via http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html
Комментариев нет:
Отправить комментарий