diff --git a/Linux_reinstall/InstallNET.sh b/Linux_reinstall/InstallNET.sh index 3d042b9..319d5a7 100644 --- a/Linux_reinstall/InstallNET.sh +++ b/Linux_reinstall/InstallNET.sh @@ -435,7 +435,7 @@ if [ "$setNet" == "0" ]; then dependence ip [ -n "$interface" ] || interface=`getInterface` # iAddr=`ip addr show dev $interface |grep "inet.*" |head -n1 |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\/[0-9]\{1,2\}'` - iAddr=`ip addr show | grep -w "inet" | grep "scope" | grep "global" | awk -F " " '{for (i=2;i<=NF;i++)printf("%s ", $i);print ""}' | awk '{print$1}'` + iAddr=`ip addr show | grep -w "inet" | grep "$interface" | grep "scope" | grep "global" | head -n 1 | awk -F " " '{for (i=2;i<=NF;i++)printf("%s ", $i);print ""}' | awk '{print$1}'` ipAddr=`echo ${iAddr} |cut -d'/' -f1` ipMask=`netmask $(echo ${iAddr} |cut -d'/' -f2)` # ipGate=`ip route show |grep "via" |grep "$interface" |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' |head -n1`