diff --git a/setup.sh b/setup.sh index af3c2d7..b9c4170 100755 --- a/setup.sh +++ b/setup.sh @@ -87,25 +87,26 @@ prompt() { fi if [ "$is_secret" = true ]; then - echo -ne "${YELLOW}${prompt_text}: ${NC}" + echo -ne "${YELLOW}${prompt_text}: ${NC}" >&2 value="" - while IFS= read -r -s -n1 char; do + while IFS= read -r -s -n1 char < /dev/tty; do if [[ $char == $'\0' ]]; then break fi if [[ $char == $'\177' ]] || [[ $char == $'\b' ]]; then if [ ${#value} -gt 0 ]; then value="${value%?}" - echo -ne "\b \b" + echo -ne "\b \b" >&2 fi else value+="$char" - echo -n "*" + echo -n "*" >&2 fi done - echo "" + echo "" >&2 else - read -p "$(echo -e ${YELLOW}${prompt_text}: ${NC})" value + echo -ne "${YELLOW}${prompt_text}: ${NC}" >&2 + read value < /dev/tty fi if [ -z "$value" ] && [ -n "$default_value" ]; then