Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 如何在Mac High上运行VPN自动机_Macos_Vpn_Macos Sierra_Automator - Fatal编程技术网

Macos 如何在Mac High上运行VPN自动机

Macos 如何在Mac High上运行VPN自动机,macos,vpn,macos-sierra,automator,Macos,Vpn,Macos Sierra,Automator,以下是我连接到VPN的代码 VPN="MY VPN NAME" IS_CONNECTED=$(test -z `scutil --nc status "$VPN" | head -n 1 | grep Connected` && echo 0 || echo 1); if [ $IS_CONNECTED = 1 ]; then scutil --nc stop "$VPN" else scutil --nc start "$VPN" fi 但是不断地出错 “应为表达式,

以下是我连接到VPN的代码

VPN="MY VPN NAME"
IS_CONNECTED=$(test -z `scutil --nc status "$VPN" | head -n 1 | grep Connected` && echo 0 || echo 1);
if [ $IS_CONNECTED = 1 ]; then
  scutil --nc stop "$VPN"
else
  scutil --nc start "$VPN"
fi
但是不断地出错

“应为表达式,但找到未知标记”


请帮我解决这个问题

如果
已连接
为整数,则需要使用整数比较:

if [ $IS_CONNECTED -eq 1 ]; then
   ...
对于字符串比较,请使用
=

if [ "$someString" = "string" ]; then
  ...