diff --git a/scripts/common.sh b/scripts/common.sh index 5a60629..c659fed 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -112,27 +112,27 @@ usePlainText() { tput sgr0 if [ $inputbox = true ]; then printLine && printf "\n" - read -r readVar + read -r readVar < /dev/tty printf '%s' "$readVar" 1>&2 elif [ $passwordbox = true ]; then printLine && printf "\n" - read -r -s readVar + read -r -s readVar < /dev/tty printf '%s' "$readVar" 1>&2 elif [ $yesno = true ]; then printLine printf '\n%s' "[y/n] " - read -n 1 -r -s readVar + read -n 1 -r -s readVar < /dev/tty while echo "$readVar" | grep -vqE '[yYnN]'; do printf "\033[A" printf '\n%s' "You need to type 'y' or 'n'" printf '\n%s' "[y/n] " - read -n 1 -r -s readVar + read -n 1 -r -s readVar < /dev/tty done [[ "$readVar" =~ ^[Yy]$ ]] && return 0 || return 1 elif [ $msgbox = true ]; then printLine printf '\n%s' "Press a key to continue... " - read -n 1 -r -s + read -n 1 -r -s < /dev/tty fi } @@ -148,12 +148,12 @@ usePlainTextMenu() { done printLine printf '\n%s' "[1..$((i-1))] " - read -n ${#i} -r readVar + read -n ${#i} -r -s readVar < /dev/tty while echo "$readVar" | grep -vqE '[0-9]+' || [[ $readVar -le 0 || $readVar -ge $i ]]; do printf "\033[A" printf '\n%s' "You need to choose a number between 1 and $((i-1))" printf '\n%s' "[1..$((i-1))] " - read -n 1 -r -s readVar + read -n ${#i} -r -s readVar < /dev/tty done printf "\n" printf '%s' "$readVar" 1>&2 @@ -182,13 +182,13 @@ usePlainTextList() { isNewline=false selectedOptions=() while [ $isNewline = false ]; do - read -n ${#j} -r readVar + read -n ${#j} -r -s readVar < /dev/tty while echo "$readVar" | grep -vqE '[0-9]+' || [[ $readVar -le 0 || $readVar -gt $j ]]; do [ "${#readVar}" -eq 0 ] && isNewline=true && break printf "\033[A" printf '\n%s' "You need to choose a number between 1 and $j)" printf '\n%s' "[1..$j] " - read -n 1 -r -s readVar + read -n ${#j} -r -s readVar < /dev/tty done [ $isNewline = true ] && break clear