while loop for menu test

This commit is contained in:
Heavybullets8 2022-07-26 18:16:56 -06:00
parent ac95a304d7
commit 61a591f023
2 changed files with 172 additions and 164 deletions

View File

@ -14,19 +14,23 @@ menu(){
echo echo
echo "0) Exit" echo "0) Exit"
read -rt 600 -p "Please select an option by number: " selection read -rt 600 -p "Please select an option by number: " selection
while true
do
case $selection in case $selection in
0) 0)
exit exit
;; ;;
1) 1)
help="true" help="true"
exit
;; ;;
2) 2)
dns="true" dns="true"
exit
;; ;;
3) 3)
mount="true" mount="true"
exit
;; ;;
4) 4)
read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups read -rt 600 -p "Please type the max number of backups to keep: " number_of_backups
@ -38,12 +42,15 @@ menu(){
;; ;;
5) 5)
restore="true" restore="true"
exit
;; ;;
6) 6)
deleteBackup="true" deleteBackup="true"
exit
;; ;;
7) 7)
self_update="true" self_update="true"
exit
;; ;;
8) 8)
script=$(readlink -f "$0") script=$(readlink -f "$0")
@ -169,11 +176,13 @@ menu(){
echo "$current_selection was not an option, try again" && sleep 5 && continue echo "$current_selection was not an option, try again" && sleep 5 && continue
fi fi
done done
exit
;; ;;
*) *)
echo "Unknown option" && exit 1 echo "That was not an option, please try again" && sleep 5
;; ;;
esac esac
echo echo
done
} }
export -f menu export -f menu

View File

@ -19,7 +19,6 @@ do
do do
kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); } kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); }
done done
#jobs=$(jobs -p | wc -l)
if [[ "$proc_count" -ge "$update_limit" ]]; then if [[ "$proc_count" -ge "$update_limit" ]]; then
sleep 1 sleep 1
else else