diff --git a/confirm-important.sh b/confirm-important.sh new file mode 100755 index 0000000..012f6f7 --- /dev/null +++ b/confirm-important.sh @@ -0,0 +1,9 @@ +#!/bin/bash +echo "Write 'yes do as i say' to confirm that you REALLY want to do this: $@" +read +if [[ "${REPLY,,}" = "yes do as i say" ]] +then + eval $@ +else + echo "aborting" +fi diff --git a/confirm.sh b/confirm.sh new file mode 100755 index 0000000..c9153bb --- /dev/null +++ b/confirm.sh @@ -0,0 +1,9 @@ +#!/bin/bash +echo "To be executed: $@" +read -p "Confirm (Y/N): " -n 1 -r +case "$REPLY" in + y|Y ) echo "es"; eval $@;; + n|N ) echo "o";; + * ) echo -e "\ninvalid";; +esac +