change invalid input to sleep 3

This commit is contained in:
Heavybullets8 2022-07-29 16:13:01 -06:00
parent 482cc99837
commit 1ce6422f23
3 changed files with 24 additions and 24 deletions

View File

@ -60,7 +60,7 @@ do
sleep 3 sleep 3
continue continue
fi fi
break break # Break out of the loop if all of the If statement checks above are untrue
done done
while true while true
do do

View File

@ -66,12 +66,12 @@ case $selection in
if [[ $up_async == 0 ]]; then if [[ $up_async == 0 ]]; then
echo "Error: \"$up_async\" is less than 1" echo "Error: \"$up_async\" is less than 1"
echo "NOT adding it to the list" echo "NOT adding it to the list"
sleep 5 sleep 3
continue continue
elif ! [[ $up_async =~ ^[0-9]+$ ]]; then elif ! [[ $up_async =~ ^[0-9]+$ ]]; then
echo "Error: \"$up_async\" is invalid, it needs to be an integer" echo "Error: \"$up_async\" is invalid, it needs to be an integer"
echo "NOT adding it to the list" echo "NOT adding it to the list"
sleep 5 sleep 3
continue continue
else else
update_selection+=("-U" "$up_async") update_selection+=("-U" "$up_async")
@ -87,12 +87,12 @@ case $selection in
if [[ $up_async == 0 ]]; then if [[ $up_async == 0 ]]; then
echo "Error: \"$up_async\" is less than 1" echo "Error: \"$up_async\" is less than 1"
echo "NOT adding it to the list" echo "NOT adding it to the list"
sleep 5 sleep 3
continue continue
elif ! [[ $up_async =~ ^[0-9]+$ ]]; then elif ! [[ $up_async =~ ^[0-9]+$ ]]; then
echo "Error: \"$up_async\" is invalid, it needs to be an integer" echo "Error: \"$up_async\" is invalid, it needs to be an integer"
echo "NOT adding it to the list" echo "NOT adding it to the list"
sleep 5 sleep 3
continue continue
else else
update_selection+=("-u" "$up_async") update_selection+=("-u" "$up_async")
@ -104,7 +104,7 @@ case $selection in
echo "Exiting.." echo "Exiting.."
exit exit
else else
echo "$current_selection was not an option, try again" && sleep 5 echo "$current_selection was not an option, try again" && sleep 3
continue continue
fi fi
done done
@ -147,48 +147,48 @@ case $selection in
exit exit
;; ;;
1 | -b) 1 | -b)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-b" && echo -e "\"-b\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
echo "Up to how many backups should we keep?" echo "Up to how many backups should we keep?"
read -rt 600 -p "Please type an integer: " up_backups read -rt 600 -p "Please type an integer: " up_backups
! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue ! [[ $up_backups =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_backups\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue
[[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 5 && continue [[ $up_backups == 0 ]] && echo -e "Error: Number of backups cannot be 0\nNOT adding it to the list" && sleep 3 && continue
update_selection+=("-b" "$up_backups") update_selection+=("-b" "$up_backups")
;; ;;
2 | -i) 2 | -i)
read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore
! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 5 && continue ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is not a possible option for an application name" && sleep 3 && continue
update_selection+=("-i" "$up_ignore") update_selection+=("-i" "$up_ignore")
;; ;;
3 | -r) 3 | -r)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-r" && echo -e "\"-r\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-r") update_selection+=("-r")
;; ;;
4 | -S) 4 | -S)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-S" && echo -e "\"-S\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-S") update_selection+=("-S")
;; ;;
5 | -v) 5 | -v)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-v" && echo -e "\"-v\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-v") update_selection+=("-v")
;; ;;
6 | -t) 6 | -t)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-t" && echo -e "\"-t\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
echo "What do you want your timeout to be?" echo "What do you want your timeout to be?"
read -rt 600 -p "Please type an integer: " up_timeout read -rt 600 -p "Please type an integer: " up_timeout
! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 5 && continue ! [[ $up_timeout =~ ^[0-9]+$ ]] && echo -e "Error: \"$up_timeout\" is invalid, it needs to be an integer\nNOT adding it to the list" && sleep 3 && continue
update_selection+=("-t" "$up_timeout") update_selection+=("-t" "$up_timeout")
;; ;;
7 | -s) 7 | -s)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-s" && echo -e "\"-s\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-s") update_selection+=("-s")
;; ;;
8 | -p) 8 | -p)
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("-p") update_selection+=("-p")
;; ;;
9 | --self-update ) 9 | --self-update )
printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it
update_selection+=("--self-update") update_selection+=("--self-update")
;; ;;
99) 99)
@ -200,17 +200,17 @@ case $selection in
echo "$i removed" echo "$i removed"
((count++)) ((count++))
done done
sleep 5 sleep 3
continue continue
;; ;;
*) *)
echo "\"$current_selection\" was not an option, try again" && sleep 5 && continue echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue
;; ;;
esac esac
done done
;; ;;
*) *)
echo "\"$selection\" was not an option, please try agian" && sleep 5 && menu echo "\"$selection\" was not an option, please try agian" && sleep 3 && menu
;; ;;
esac esac
echo echo

View File

@ -73,7 +73,7 @@ do
;; ;;
*) *)
echo "Invalid selection \"$yesno\" was not an option" echo "Invalid selection \"$yesno\" was not an option"
sleep 2 sleep 3
continue continue
;; ;;
esac esac
@ -101,11 +101,11 @@ do
fi fi
done done
rmdir /mnt/heavyscript rmdir /mnt/heavyscript
sleep 2 sleep 3
;; ;;
*) *)
echo "Invalid selection, \"$selection\" was not an option" echo "Invalid selection, \"$selection\" was not an option"
sleep 2 sleep 3
continue continue
;; ;;
esac esac