diff --git a/scripts/gateway-watchdog.sh b/scripts/gateway-watchdog.sh index 65b7379..0e61bf4 100755 --- a/scripts/gateway-watchdog.sh +++ b/scripts/gateway-watchdog.sh @@ -146,7 +146,7 @@ _safe_count() { count=$(grep -c "$1" 2>/dev/null || true) # 去掉所有空白和换行,确保是纯数字 count=$(echo "$count" | tr -d '[:space:]') - [ -z "$count" ] && count=0 + if [ -z "$count" ]; then count=0; fi echo "$count" }