From 2b19d88ecc284718637b77a31d8c497df4970618 Mon Sep 17 00:00:00 2001 From: Kvnpsiddhartha Date: Fri, 31 Jul 2026 14:28:09 +0530 Subject: [PATCH] fix: avoid set -e failures in interactive menu navigation Replace standalone arithmetic increment/decrement expressions with assignment-based arithmetic to prevent Bash treating zero results as command failures under set -e. --- scripts/prepare-demo.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/prepare-demo.sh b/scripts/prepare-demo.sh index 59e3f36..cbcd057 100755 --- a/scripts/prepare-demo.sh +++ b/scripts/prepare-demo.sh @@ -72,7 +72,7 @@ multiselect() { else print_inactive "$prefix" "$option" fi - ((idx++)) + idx=$((idx + 1)) done case $(key_input) in @@ -84,8 +84,12 @@ multiselect() { fi ;; enter) break;; - up) ((active--)); if [ $active -lt 0 ]; then active=$((${#options[@]} - 1)); fi;; - down) ((active++)); if [ $active -ge ${#options[@]} ]; then active=0; fi;; + up) + active=$((active - 1)); + if [ $active -lt 0 ]; then active=$((${#options[@]} - 1)); fi;; + down) + active=$((active + 1)); + if [ $active -ge ${#options[@]} ]; then active=0; fi;; ctrlc) cursor_blink_on; printf "\n"; exit 130;; esac done