From 04738329153ee15afa6b4c638dfbbd3f054ea4a4 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Mon, 19 Oct 2020 20:14:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E8=AF=86=E5=88=ABip=E7=9A=84bug=E3=80=81?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E6=89=A7=E8=A1=8C=E9=94=99=E8=AF=AF=E6=8E=92?= =?UTF-8?q?=E6=9F=A5=E6=8A=A5=E9=94=99=E4=BF=A1=E6=81=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 5d32a04..70e6470 100644 --- a/install.sh +++ b/install.sh @@ -264,11 +264,7 @@ initTLSNginxConfig(){ } # 检查ip checkIP(){ - pingIP=`ping -c 1 -W 1000 ${domain}|awk '{print $4}'|head -2|tail -n 1` - if [[ ! -z "${pingIP}" ]] - then - pingIP=`echo ${pingIP}|awk -F "[.]" '{print $1"."$2"."$3"."$4}'` - fi + pingIP=`ping -c 1 -W 1000 ${domain}|sed '1{s/[^(]*(//;s/).*//;q}'` if [[ ! -z "${pingIP}" ]] && [[ `echo ${pingIP}|grep '^\([1-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)$'` ]] then read -p "当前域名的IP为 [${pingIP}],是否正确[y/n]?" domainStatus