修复脚本无法获取部分移动云电脑的 IP

移动云电脑第一条默认路由是 VPN 网卡,其 MAC 为空,通过此特征进行排除
This commit is contained in:
bin456789
2024-06-23 01:25:23 +08:00
parent c682835af6
commit 5b0cf3df1a
4 changed files with 116 additions and 68 deletions

View File

@ -26,9 +26,9 @@ fi
# debian 12 initrd 没有 xargs
get_ethx() {
if false; then
ip -o link | grep "$mac_addr" | awk '{print $2}' | cut -d: -f1
ip -o link | grep -i "$mac_addr" | awk '{print $2}' | cut -d: -f1
else
ip -o link | grep "$mac_addr" | cut -d' ' -f2 | cut -d: -f1
ip -o link | grep -i "$mac_addr" | cut -d' ' -f2 | cut -d: -f1
fi
}