This commit is contained in:
Heavybullets8 2022-07-26 23:02:45 -06:00
parent a44b250390
commit 0c7479801e

View File

@ -132,43 +132,44 @@ case $selection in
exit exit
;; ;;
1) 1)
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-b" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && 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 5 && 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 5 && continue
update_selection+=("-b" "$up_backups") update_selection+=("-b" "$up_backups")
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
;; ;;
2) 2)
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
update_selection+=("-i" "$up_ignore") update_selection+=("-i" "$up_ignore")
;; ;;
3) 3)
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-r" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
update_selection+=("-r") update_selection+=("-r")
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
;; ;;
4) 4)
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-S" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
update_selection+=("-S") update_selection+=("-S")
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
;; ;;
5) 5)
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-v" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
update_selection+=("-v") update_selection+=("-v")
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
;; ;;
6) 6)
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-t" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && 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 5 && continue
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
update_selection+=("-t" "$up_timeout") update_selection+=("-t" "$up_timeout")
;; ;;
7) 7)
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-s" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
update_selection+=("-s") update_selection+=("-s")
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
;; ;;
8) 8)
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "-p" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
update_selection+=("-p") update_selection+=("-p")
printf '%s\0' "${update_selection[@]}" | grep -iFxqz "$OPTARG" && echo -e "$OPTARG is already on here, skipping" && sleep 5 && continue #If option is already on there, skip it
;; ;;
*) *)
echo "\"$OPTARG\" was not an option, try again" && sleep 5 && continue echo "\"$OPTARG\" was not an option, try again" && sleep 5 && continue