From c805c46dfc1c591e42405954a45f5f561d6e88c2 Mon Sep 17 00:00:00 2001 From: Nyx <144965845+nnyyxxxx@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:30:49 -0400 Subject: [PATCH] Remove bashisms out of managearrangement (#463) Co-authored-by: nnyyxxxx --- tabs/utils/monitor-control/manage_arrangement.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tabs/utils/monitor-control/manage_arrangement.sh b/tabs/utils/monitor-control/manage_arrangement.sh index 268b930f..684dbfd4 100755 --- a/tabs/utils/monitor-control/manage_arrangement.sh +++ b/tabs/utils/monitor-control/manage_arrangement.sh @@ -20,7 +20,8 @@ manage_arrangement() { i=$((i + 1)) done - read -p "Enter the number of the monitor to arrange: " monitor_choice + printf "Enter the number of the monitor to arrange: " + read -r monitor_choice if ! echo "$monitor_choice" | grep -qE '^[0-9]+$' || [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$((i - 1))" ]; then printf "%b\n" "${RED}Invalid selection.${RC}" @@ -36,7 +37,8 @@ manage_arrangement() { printf "%b\n" "3. ${YELLOW}Above${RC}" printf "%b\n" "4. ${YELLOW}Below${RC}" - read -p "Enter the number of the position: " position_choice + printf "Enter the number of the position: " + read -r position_choice case $position_choice in 1) position="--left-of" ;; @@ -53,7 +55,8 @@ manage_arrangement() { fi done - read -p "Enter the number of the reference monitor: " ref_choice + printf "Enter the number of the reference monitor: " + read -r ref_choice if ! echo "$ref_choice" | grep -qE '^[0-9]+$' || [ "$ref_choice" -lt 1 ] || [ "$ref_choice" -gt "$((i - 1))" ] || [ "$ref_choice" -eq "$monitor_choice" ]; then printf "%b\n" "${RED}Invalid selection.${RC}"