需求

        因为定制的ubuntu没有dbus,导致qtnetwork的allinterface接口(获取网卡)调用失败,更改方式:使用脚本获取mac地址到文件,qt从文件中读取。


错误截图

        linux实用技巧:使用脚本获取活动网卡的mac地址_ubuntu


脚本获取

ifconfig $if | head -n 1 | awk `{print $5}`

ifconfig $if | head -n 1 | awk `{print $5}` > home/tc/mac

linux实用技巧:使用脚本获取活动网卡的mac地址_ubuntu_02