AppleScript无法在curl命令中转义多个引号

时间:2018-03-28 08:48:28

标签: curl applescript

我正在尝试在Apple脚本中运行curl命令,我正在执行以下操作:

set trial_1 to "/somepath"

set output to do shell script ("export TRIAL_1=" & trial_1)

set output to do shell script ("curl -H 'Content-Type: application/json' -X POST -d '{\"desiredCapabilities\":{"xcodeConfigFile\":quoted form of output}}'http://localhost:4723/wd/hub/session")

这是以“引用的输出形式”作为参数并运行。我想要做的是使用输出的变量值运行。

当我在终端上尝试curl命令时

curl -H 'Content-Type: application/json' -X POST -d '{\"desiredCapabilities\":{"xcodeConfigFile\":"'"$TRIAL_1"'"}}'http://localhost:4723/wd/hub/session,

它就像一个魅力。我如何在AppleScript中传递相同内容?

1 个答案:

答案 0 :(得分:0)

经过一段时间的试验,我得到了它。

设置输出以执行shell脚本(“curl -H'Content-Type:application / json'-X POST -d'{\”desiredCapabilities \“:{”xcodeConfigFile \“:\”'\“$ TRIAL_1 \ “'\”}}'http://localhost:4723/wd/hub/session“)

相关问题