Skip to content

Commit

Permalink
Remove bashisms from disable monitor (#472)
Browse files Browse the repository at this point in the history
Co-authored-by: nnyyxxxx <[email protected]>
  • Loading branch information
nnyyxxxx and nnyyxxxx authored Sep 19, 2024
1 parent 719548f commit e783512
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tabs/utils/monitor-control/disable_monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ disable_monitor() {
i=$((i + 1))
done

read -p "Enter the number of the monitor: " monitor_choice
printf "%b\n" "Enter the number of the monitor: "
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}"
Expand All @@ -44,7 +45,8 @@ disable_monitor() {
confirm_action() {
action="$1"
printf "%b\n" "${YELLOW}$action${RC}"
read -p "Are you sure? (y/n): " confirm
printf "%b\n" "Are you sure? (y/n): "
read -r confirm
if echo "$confirm" | grep -qE '^[Yy]$'; then
return 0
else
Expand Down

0 comments on commit e783512

Please sign in to comment.