From 8a2fd2a976c23c8fef70164d344f0f4c502dde71 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 26 Jul 2022 16:35:31 -0600 Subject: [PATCH] regex --- functions/menu.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/functions/menu.sh b/functions/menu.sh index 712d580a..aa024a84 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -64,11 +64,9 @@ menu(){ if [[ $current_selection == 1 ]]; then echo -e "\nHow many applications do you want updating at the same time?" read -rt 600 -p "Please type an integer greater than 0: " up_async - update_selection+=("-U" "$up_async") elif [[ $current_selection == 2 ]]; then echo -e "\nHow many applications do you want updating at the same time?" - read -rt 600 -p "Please type an integer greater than 0: " up_async - update_selection+=("-u" "$up_async") + read -rt 600 -p "Please type an integer greater than 0: " up_async elif [[ $current_selection == 0 ]]; then echo "Exiting.." exit @@ -76,6 +74,15 @@ menu(){ echo "$current_selection was not an option, try again" exit fi + if [[ $up_async == 0 ]]; then + echo "0 was not an option.. exiting" + exit + elif ! [[ $up_async =~ ^[0-9]+$ ]]; then + echo "Error: $up_async is invalid, it needs to be an integer" + exit + else + update_selection+=("-u" "$up_async") + fi while true do clear -x