Browse Source

更新 'init-per.sh'

胡增文 6 months ago
parent
commit
5bf84f4c47
1 changed files with 1 additions and 1 deletions
  1. 1 1
      init-per.sh

+ 1 - 1
init-per.sh

@@ -103,7 +103,7 @@ fi
 ip -o link show | awk -F': ' '{print $2}' | while read interface; do
     # 处理192.168.3网段的网卡
     mac=$(ip link show dev "$interface" | awk '/link\/ether/ {print $2}')
-    ip=$(ip addr show dev "$interface" | awk '/inet 192.168.6/ {print $2}')
+    ip=$(ip addr show dev "$interface" | awk '/inet (192\.168\.(3|6))/ {print $2}')
     if [ -n "$ip" ] && [ -n "$mac" ]; then
         subnet=$(echo "$ip" | awk -F'/' '{print $1}' | awk -F'.' '{print $1"."$2"."$3}')
         echo "网卡名称: $interface,MAC地址: $mac,IP地址: $(echo $ip | cut -d '/' -f 1), subnet: $subnet"