From 45fd2e35d5f1bb8ed85f77372bbba2690474b489 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sun, 22 Sep 2024 12:36:46 +0200 Subject: [PATCH] confirm --- confirm-important.sh | 9 +++++++++ confirm.sh | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100755 confirm-important.sh create mode 100755 confirm.sh 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 +