mirror of
https://github.com/leitbogioro/Tools.git
synced 2024-11-15 13:44:50 +08:00
Update InstallNET.sh
This commit is contained in:
parent
3bb22d4e36
commit
aee3390bb4
1 changed files with 1 additions and 1 deletions
|
@ -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`
|
||||
|
|
Loading…
Reference in a new issue