delete-backup avoid extra calls

This commit is contained in:
Heavybullets8 2022-07-29 00:25:20 -06:00
parent 4841c568fa
commit 571e00a2f4

View File

@ -42,22 +42,27 @@ do
title title
echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups" echo -e "Choose a Restore Point to Delete\nThese may be out of order if they are not HeavyScript backups"
fi fi
echo "$list_backups" while true
echo do
echo "0) Exit" echo "$list_backups"
read -rt 120 -p "Please type a number: " selection echo
[[ $selection == 0 ]] && echo "Exiting.." && exit echo "0) Exit"
restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}') read -rt 120 -p "Please type a number: " selection
#Check for valid selection. If none, kill script restore_point=$(echo "$list_backups" | grep ^"$selection)" | awk '{print $2}')
if [[ -z "$selection" ]]; then if [[ $selection == 0 ]]; then
echo "Your selection cannot be empty" echo "Exiting.."
sleep 3 exit
continue elif [[ -z "$selection" ]]; then
elif [[ -z "$restore_point" ]]; then echo "Your selection cannot be empty"
echo "Invalid Selection: $selection, was not an option" sleep 3
sleep 3 continue
continue elif [[ -z "$restore_point" ]]; then
fi echo "Invalid Selection: $selection, was not an option"
sleep 3
continue
fi
break
done
while true while true
do do
clear -x clear -x