如何从AppleScript运行shell脚本?

时间:2016-04-16 19:37:28

标签: macos shell applescript

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

当我尝试从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"

我做错了什么?

1 个答案:

答案 0 :(得分:1)

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

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