Remove bashisms from disable monitor (#472)

Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
This commit is contained in:
Nyx 2024-09-18 20:01:18 -04:00 committed by GitHub
parent 719548f971
commit e78351244a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,7 +20,8 @@ disable_monitor() {
i=$((i + 1)) i=$((i + 1))
done 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 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}" printf "%b\n" "${RED}Invalid selection.${RC}"
@ -44,7 +45,8 @@ disable_monitor() {
confirm_action() { confirm_action() {
action="$1" action="$1"
printf "%b\n" "${YELLOW}$action${RC}" 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 if echo "$confirm" | grep -qE '^[Yy]$'; then
return 0 return 0
else else