OSX中是否还有编写切换网络首选项的脚本? I.E.从以太网切换到wifi再返回。
我熟悉在Windows中编写批处理文件但在MacOS中编写
答案 0 :(得分:0)
可能最简单的方法是已经定义了位置,然后执行以下操作:
#!/bin/sh
if [[ $# -eq 0 ]] ; then
echo "No arguments, try one of this:"; networksetup -listlocations
echo "Current location: "; networksetup -getcurrentlocation
exit 1
fi
eval networksetup -switchtolocation \"$@"\
如果网络位置已成功更改,则会打印found it!