From 97929bcbe9b2b29afdbbdd02f5cdb16906f077ca Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 21 May 2019 04:46:53 -0600 Subject: [PATCH] add user confirmation to execute --- f2b-config.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/f2b-config.sh b/f2b-config.sh index 51dbf03..95a5b69 100755 --- a/f2b-config.sh +++ b/f2b-config.sh @@ -114,6 +114,26 @@ echo -e "how to customize these template files.${normal}" echo -e "${note}--------------------------------------------------------------------------------${normal}" echo +# confirm user wants to proceed +while true; do + read -rp "Do you want to proceed? (default: Yes) " yn + case "${yn}" in + [Yy]*|'') + break + ;; + [Nn]*) + # exit gracefully, user choice + echo -e "\n${info}Exiting now.${normal}\n" + exit 0 + ;; + *) + # invalid input + echo -e "\n${lit}Please answer (Y)es or (N)o or accept default" \ + "${normal}" + ;; + esac +done + ### copy template files # note: prefixing cp with '\' to override any alias settings