From 310519231265e6307de7ccd8d1cab288d72d91e6 Mon Sep 17 00:00:00 2001 From: Fabien Mathey Date: Tue, 28 Nov 2017 15:15:12 +0100 Subject: [PATCH] Allow for multiple entries like 1 2 3 4 5 Should replace the need to type 12 etc. and allows for 1 2 3 4 5 --- bin/LAUNCH.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/LAUNCH.sh b/bin/LAUNCH.sh index 63503a63..5eeb53c2 100755 --- a/bin/LAUNCH.sh +++ b/bin/LAUNCH.sh @@ -239,12 +239,14 @@ menu() { } prompt="Check an option (again to uncheck, ENTER when done): " -while menu && read -rp "$prompt" num && [[ "$num" ]]; do - [[ "$num" != *[![:digit:]]* ]] && (( num > 0 && num <= ${#options[@]} )) || { - msg="Invalid option: $num"; continue - } - ((num--)); msg="${options[num]} was ${choices[num]:+un}checked" - [[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+" +while menu && read -rp "$prompt" numinput && [[ "$numinput" ]]; do + for num in $numinput; do + [[ "$num" != *[![:digit:]]* ]] && (( num > 0 && num <= ${#options[@]} )) || { + msg="Invalid option: $num"; break + } + ((num--)); msg="${options[num]} was ${choices[num]:+un}checked" + [[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+" + done done for i in ${!options[@]}; do