From 5a1f5a087e3e8bd0a75c60350763917b0f84dee7 Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Tue, 30 Aug 2022 22:06:20 -0600 Subject: [PATCH] validity check for backup --- functions/menu.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/functions/menu.sh b/functions/menu.sh index 921b64f6..e4cf5a45 100644 --- a/functions/menu.sh +++ b/functions/menu.sh @@ -32,6 +32,8 @@ case $selection in ;; 4) read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; } + ! [[ $number_of_backups =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit + [[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit ;; 5) restore