From c6da7fea2673a0893af3a8547830e37d596ab6db Mon Sep 17 00:00:00 2001 From: zhiayang Date: Sun, 10 Mar 2024 22:25:50 -0400 Subject: [PATCH] fix shell script --- docs/src/templates/setup.sh.mustache | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/src/templates/setup.sh.mustache b/docs/src/templates/setup.sh.mustache index 09ed8c29..b19c96cb 100644 --- a/docs/src/templates/setup.sh.mustache +++ b/docs/src/templates/setup.sh.mustache @@ -166,20 +166,22 @@ if [ "$keyboard_shield" == "y" ]; then echo "" echo "MCU Board Revision:" select opt in "${_valid_revisions[@]}" "Quit"; do - ''|*[!0-9]*) echo "Invalid option. Try another one."; continue;; + case "$REPLY" in + ''|*[!0-9]*) echo "Invalid option. Try another one."; continue;; - $(( ${#_valid_revisions[@]}+1 )) ) echo "Goodbye!"; exit 1;; - *) - if [ $REPLY -gt $(( ${#_valid_revisions[@]}+1 )) ] || [ $REPLY -lt 0 ]; then - echo "Invalid option. Try another one." - continue - fi + $(( ${#_valid_revisions[@]}+1 )) ) echo "Goodbye!"; exit 1;; + *) + if [ $REPLY -gt $(( ${#_valid_revisions[@]}+1 )) ] || [ $REPLY -lt 0 ]; then + echo "Invalid option. Try another one." + continue + fi - _rev_index=$(( $REPLY-1 )) - board="${board_ids[$board_index]}@${_valid_revisions[_rev_index]}" - boards=( "${board}" ) - break - ;; + _rev_index=$(( $REPLY-1 )) + board="${board_ids[$board_index]}@${_valid_revisions[_rev_index]}" + boards=( "${board}" ) + break + ;; + esac done fi else