From 7786a3e8ac6371cd242564ed232fc647308e6b3b Mon Sep 17 00:00:00 2001 From: svefnz Date: Thu, 19 Mar 2026 16:06:36 +0800 Subject: [PATCH] update hy2.sh --- hy2.sh | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/hy2.sh b/hy2.sh index dc32ec3..8eba2c6 100644 --- a/hy2.sh +++ b/hy2.sh @@ -32,26 +32,12 @@ prompt_nonempty() { local prompt="$1" local value="" while true; do - read -r -p "$prompt" value + read -r -p "$prompt" value < /dev/tty if [[ -n "${value// }" ]]; then printf '%s' "$value" return 0 fi - yellow "输入不能为空,请重新输入。" - done -} - -prompt_secret_nonempty() { - local prompt="$1" - local value="" - while true; do - read -r -s -p "$prompt" value - echo - if [[ -n "${value// }" ]]; then - printf '%s' "$value" - return 0 - fi - yellow "输入不能为空,请重新输入。" + yellow "输入不能为空,请重新输入。" >&2 done } @@ -505,7 +491,7 @@ main() { subdomain="${subdomain:-$default_subdomain}" subdomain="$(printf '%s' "$subdomain" | tr 'A-Z' 'a-z' | tr -cd 'a-z0-9-')" - CF_API_TOKEN="$(prompt_secret_nonempty '请输入 Cloudflare API Token: ')" + CF_API_TOKEN="$(prompt_nonempty '请输入 Cloudflare API Token: ')" export CF_API_TOKEN password="$(generate_password)"