while loop for async check

This commit is contained in:
Heavybullets8 2022-07-29 01:22:59 -06:00
parent 717306e01f
commit 4f303e3489

View File

@ -59,39 +59,47 @@ case $selection in
echo echo
read -rt 600 -p "Please type the number associated with the flag above: " current_selection read -rt 600 -p "Please type the number associated with the flag above: " current_selection
if [[ $current_selection == 1 ]]; then if [[ $current_selection == 1 ]]; then
echo -e "\nHow many applications do you want updating at the same time?" while true
read -rt 600 -p "Please type an integer greater than 0: " up_async do
if [[ $up_async == 0 ]]; then echo -e "\nHow many applications do you want updating at the same time?"
echo "Error: \"$up_async\" is less than 1" read -rt 600 -p "Please type an integer greater than 0: " up_async
echo "NOT adding it to the list" if [[ $up_async == 0 ]]; then
sleep 5 echo "Error: \"$up_async\" is less than 1"
continue echo "NOT adding it to the list"
elif ! [[ $up_async =~ ^[0-9]+$ ]]; then sleep 5
echo "Error: \"$up_async\" is invalid, it needs to be an integer" continue
echo "NOT adding it to the list" elif ! [[ $up_async =~ ^[0-9]+$ ]]; then
sleep 5 echo "Error: \"$up_async\" is invalid, it needs to be an integer"
continue echo "NOT adding it to the list"
else sleep 5
update_selection+=("-U" "$up_async") continue
break else
fi update_selection+=("-U" "$up_async")
break
fi
done
break
elif [[ $current_selection == 2 ]]; then elif [[ $current_selection == 2 ]]; then
echo -e "\nHow many applications do you want updating at the same time?" while true
read -rt 600 -p "Please type an integer greater than 0: " up_async do
if [[ $up_async == 0 ]]; then echo -e "\nHow many applications do you want updating at the same time?"
echo "Error: \"$up_async\" is less than 1" read -rt 600 -p "Please type an integer greater than 0: " up_async
echo "NOT adding it to the list" if [[ $up_async == 0 ]]; then
sleep 5 echo "Error: \"$up_async\" is less than 1"
continue echo "NOT adding it to the list"
elif ! [[ $up_async =~ ^[0-9]+$ ]]; then sleep 5
echo "Error: \"$up_async\" is invalid, it needs to be an integer" continue
echo "NOT adding it to the list" elif ! [[ $up_async =~ ^[0-9]+$ ]]; then
sleep 5 echo "Error: \"$up_async\" is invalid, it needs to be an integer"
continue echo "NOT adding it to the list"
else sleep 5
update_selection+=("-u" "$up_async") continue
break else
fi update_selection+=("-u" "$up_async")
break
fi
done
break
elif [[ $current_selection == 0 ]]; then elif [[ $current_selection == 0 ]]; then
echo "Exiting.." echo "Exiting.."
exit exit