Update InstallNET.sh

This commit is contained in:
Molly Lau 2022-11-16 20:50:04 +09:00 committed by GitHub
parent 1a4388aa3b
commit 3bb22d4e36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -434,7 +434,8 @@ fi
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 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}'`
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`