add user confirmation to execute

This commit is contained in:
Asif Bacchus 2019-05-21 04:46:53 -06:00
parent 4c07f53266
commit 97929bcbe9
1 changed files with 20 additions and 0 deletions

View File

@ -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