From ba6ca6e2c2cd41ad60b05e1ac5f1673722ee7b5a Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 31 Jul 2021 18:45:47 -0500 Subject: [PATCH] Confirmation.bash tweaks --- Functions/Confirmation.bash | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Functions/Confirmation.bash b/Functions/Confirmation.bash index 14b5a87..dcf458b 100755 --- a/Functions/Confirmation.bash +++ b/Functions/Confirmation.bash @@ -2,6 +2,7 @@ confirmation() { # Receive confirmation from user as y, Y, n, or N + # returns 0 when answer is yes and 1 when answer is no # # Arguments: # message @@ -22,10 +23,16 @@ confirmation() { local choice while true; do - read -p "${message}" -n 1 -r choice + read -p "${message} " -n 1 -r choice case "$choice" in - y | Y) return 1 ;; - n | N) return 0 ;; + y | Y) + echo "" + return 0 + ;; + n | N) + echo "" + return 1 + ;; *) echo -e "\nInput must be either y, Y, n, or N" ;; esac done