From aee3390bb45500de2b6f065d8e559911f973abdf Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Wed, 16 Nov 2022 20:53:21 +0900 Subject: [PATCH] Update InstallNET.sh --- Linux_reinstall/InstallNET.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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`