From ccb965359c40f2ebc6fa1377329813a4c5c97ac4 Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 23 Mar 2016 20:23:56 +0800 Subject: [PATCH] compatible for windows netstat tool --- le.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/le.sh b/le.sh index bd1bb8d..6feac9b 100755 --- a/le.sh +++ b/le.sh @@ -183,7 +183,12 @@ _ss() { _port="$1" if command -v "netstat" >/dev/null 2>&1 ; then _debug "Using: netstat" - netstat -ntpl | grep :$_port" " + if netstat -h 2>&1 | grep "\-p proto" >/dev/null ; then + #for windows version netstat tool + netstat -nb -p tcp | grep :$_port" " + else + netstat -ntpl | grep :$_port" " + fi return 0 fi if command -v "ss" >/dev/null 2>&1 ; then