fix: allow non-single digit instance counts containing a 0 #129

This commit is contained in:
th33xitus
2021-10-22 23:52:58 +02:00
parent f231fa9c69
commit 8d3ddc273a
2 changed files with 3 additions and 3 deletions

View File

@@ -20,10 +20,10 @@ klipper_setup_dialog(){
### ask for amount of instances to create
INSTANCE_COUNT=""
while [[ ! ($INSTANCE_COUNT =~ ^[1-9]+$) ]]; do
while [[ ! ($INSTANCE_COUNT =~ ^[1-9]+((0)+)?$) ]]; do
echo
read -p "${cyan}###### Number of Klipper instances to set up:${default} " INSTANCE_COUNT
if [[ ! ($INSTANCE_COUNT =~ ^[1-9]+$) ]]; then
if [[ ! ($INSTANCE_COUNT =~ ^[1-9]+((0)+)?$) ]]; then
warn_msg "Invalid Input!" && echo
else
echo

View File

@@ -48,7 +48,7 @@ moonraker_setup_dialog(){
if [ "$(systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
INSTANCE_COUNT=1
else
INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]].service" | wc -l)
INSTANCE_COUNT=$(systemctl list-units --full -all -t service --no-legend | grep -E "klipper-[[:digit:]]+.service" | wc -l)
fi
### initial moonraker.conf path check