diff --git a/scripts/lib/common.sh b/scripts/lib/common.sh index 8b79031..aba232c 100644 --- a/scripts/lib/common.sh +++ b/scripts/lib/common.sh @@ -158,7 +158,7 @@ confirm_destructive() { if [[ "${GITEA_YES:-0}" == "1" ]]; then return 0 fi - if [[ ! -r /dev/tty ]]; then + if ! { true < /dev/tty; } 2>/dev/null; then log_err "需要確認但無 TTY;請加 -y / --yes 或設定 GITEA_YES=1" exit 1 fi @@ -178,7 +178,7 @@ confirm_exact_match() { if [[ "${GITEA_YES:-0}" == "1" ]]; then return 0 fi - if [[ ! -r /dev/tty ]]; then + if ! { true < /dev/tty; } 2>/dev/null; then log_err "需要確認但無 TTY;請加 -y / --yes 或設定 GITEA_YES=1" exit 1 fi