[英]How does this os x bash script that emulates linux's readlink work?
[英]BASH on OS X: Why does this script not work?
使用欺骗的MAC地址完成后,我编写了以下BASH脚本将我的MAC地址更改回普通地址:
sudo ifconfig en1 ether 00:11:22:33:44:55
有用。 但是,以下代码不起作用:
mac=$(cat /volumes/KYLE-OSX/mac.txt)
sudo ifconfig en1 ether $mac
我收到以下错误消息:ifconfig:无法设置链接级网络掩码或广播
我无法预测MAC地址是什么,因此我需要能够在'sudo ifconfig en1 ether'语句中使用任何可能的MAC地址。
已经在注释中诊断出了根本问题-文件中不仅包含MAC地址。 这是一个简单的解决方法。
mac=$(grep -Eo '\<[0-9a-f]{2}(:[0-9a-f]{2}){5}\>' /Volumes/KYLE-OSX/mac.txt)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.