From 01f1e3d6b93f74c533452cede8f57ea5f8bcdce3 Mon Sep 17 00:00:00 2001 From: Toyo Date: Mon, 24 Jul 2017 11:36:53 +0800 Subject: [PATCH] =?UTF-8?q?#=20v1.0.4=20=E4=BF=AE=E5=A4=8D=20=E5=8D=B8?= =?UTF-8?q?=E8=BD=BDSocat=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- socat.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/socat.sh b/socat.sh index 26e1045..84dfb1d 100644 --- a/socat.sh +++ b/socat.sh @@ -5,7 +5,7 @@ export PATH #================================================= # System Required: Debian/Ubuntu # Description: Socat -# Version: 1.0.3 +# Version: 1.0.4 # Author: Toyo # Blog: https://doub.io/wlzy-18/ #================================================= @@ -297,7 +297,8 @@ uninstallSocat(){ stty erase '^H' && read -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then - kill -9 $(ps -ef | grep "socat" | grep -v grep | awk '{print $2}') + PID=$(ps -ef | grep "socat" | grep -v grep | grep -v ".sh" |awk '{print $2}') + [[ ! -z "${PID}" ]] && kill -9 "${PID}" apt-get remove --purge socat -y sed -i "/socat/d" /etc/rc.local [[ -e ${socat_file} ]] && echo -e "${Error} Socat 卸载失败,请检查 !" && exit 1