fix shell script

This commit is contained in:
zhiayang 2024-03-10 22:25:50 -04:00
parent 4fd32718e1
commit c6da7fea26
No known key found for this signature in database
GPG key ID: 5E2F30AD6F08571F

View file

@ -166,20 +166,22 @@ if [ "$keyboard_shield" == "y" ]; then
echo "" echo ""
echo "MCU Board Revision:" echo "MCU Board Revision:"
select opt in "${_valid_revisions[@]}" "Quit"; do 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;; $(( ${#_valid_revisions[@]}+1 )) ) echo "Goodbye!"; exit 1;;
*) *)
if [ $REPLY -gt $(( ${#_valid_revisions[@]}+1 )) ] || [ $REPLY -lt 0 ]; then if [ $REPLY -gt $(( ${#_valid_revisions[@]}+1 )) ] || [ $REPLY -lt 0 ]; then
echo "Invalid option. Try another one." echo "Invalid option. Try another one."
continue continue
fi fi
_rev_index=$(( $REPLY-1 )) _rev_index=$(( $REPLY-1 ))
board="${board_ids[$board_index]}@${_valid_revisions[_rev_index]}" board="${board_ids[$board_index]}@${_valid_revisions[_rev_index]}"
boards=( "${board}" ) boards=( "${board}" )
break break
;; ;;
esac
done done
fi fi
else else