
私はOSX Yosemite v.10.10.5を実行しているMacを使用しています。
AppleScript からシェル スクリプトを実行しようとすると、次のエラー メッセージが表示されます。
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
コマンドライン
chmod a+x myShellScript.sh
または
myAppleScript.applescriptdo shell script "bash /Users/path/to/file/myShellScript.sh"
さらに: シェルスクリプトの先頭にシェバンを追加する
myShellScript.sh#!/bin/bash
sh
注: over を使用する場合はbash
、コマンドでそれを置き換えて、シバン。