From 0c32b1c48894b8ce3c07ee1ecf0f88b6bb728e66 Mon Sep 17 00:00:00 2001 From: Eric Sears Date: Fri, 13 Dec 2024 16:14:08 -0500 Subject: [PATCH] Standardize confirm_continue function --- include/menus.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/menus.sh b/include/menus.sh index 1eebc1f..007e5e4 100644 --- a/include/menus.sh +++ b/include/menus.sh @@ -73,12 +73,14 @@ prompt_boolean() { } confirm_continue() { - # Function to prompt the user to press Y or y to continue. - # Exits the script if the user does not press Y or y. + # Function to prompt the user to press Y, y, or Enter to continue. + # Exits the script if the user does not press Y, y, or Enter. - read -p " Do you want to continue? (Y/y to continue): " -n 1 -r + read -p " Do you want to continue? (Y/n): " -n 1 -r echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then + if [[ -z $REPLY || $REPLY =~ ^[Yy]$ ]]; then + return + else print_msg ERROR " Operation aborted." exit 1 fi