From c55b2a5a0a889204c04c4b60dc0d891a79fb592f Mon Sep 17 00:00:00 2001 From: shendongming Date: Tue, 5 Aug 2014 09:42:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=20mac=2010.9=20=E4=B8=8B=20?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=20ip-up=20=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OLDGW=`netstat -nr | grep '^default' | grep -v 'ppp' | sed 's/default *\\([0-9\.]*\\) .*/\\1/' | awk '{if($1){print $1}}'` 去掉 oldgw 前面多余的空行 --- chnroutes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chnroutes.py b/chnroutes.py index 9c235a2..06bc4e5 100755 --- a/chnroutes.py +++ b/chnroutes.py @@ -70,7 +70,7 @@ def generate_mac(metric): #!/bin/sh export PATH="/bin:/sbin:/usr/sbin:/usr/bin" - OLDGW=`netstat -nr | grep '^default' | grep -v 'ppp' | sed 's/default *\\([0-9\.]*\\) .*/\\1/'` + OLDGW=`netstat -nr | grep '^default' | grep -v 'ppp' | sed 's/default *\\([0-9\.]*\\) .*/\\1/' | awk '{if($1){print $1}}'` if [ ! -e /tmp/pptp_oldgw ]; then echo "${OLDGW}" > /tmp/pptp_oldgw