如何从 AppleScript 运行 shell 脚本?

How to run a shell script from an AppleScript?

我正在使用 Mac 运行ning OSX Yosemite v.10.10.5.

当我尝试从我的 AppleScript 运行 我的 shell 脚本时,我收到以下错误消息:

AppleScript 脚本编辑器中的错误消息
error "sh: /Users/path/to/file/myShellScript.sh: Permission denied" number 126
myShellScript.sh
cd /Users/myusername/Git/myproject/
git remote remove origin
myAppleScript.applescript
do shell script "/Users/path/to/file/myShellScript.sh"

我做错了什么?

您的 shell 脚本可能缺少执行权限 (+x)。使用 shell 命令添加 chmod a+x myShellScript.sh 或在 shell 脚本前添加 shell 可执行文件名称,例如:

do shell script "bash /Users/path/to/file/myShellScript.sh"