2017-05-12 15 views
-1

私はダブルクリックできるコマンドファイルを実行しています。ファイル名:Documents.commandは、ターミナルウィンドウを開かずにバックグラウンドでプロセスを実行します。したがって、端末アプリを閉じるには& pkill -f -a Terminalを使用しています。nohupを実行していますosascript do shell - エラーが発生しました

以前は動作していましたが、今度は自分のDocumentsフォルダが複数回開きます。意味、10秒以内にフォルダを閉じると、再び開きます。

スクリプトコード:

#!/bin/sh 

open ~/Documents 

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 
nohup osascript -e 'do shell script "'"$DIR"'/Documents.command"' & pkill -f -a Terminal 

私はディスプレイに以下のエラーが記録されてきたログファイル:ここでの問題のようです何

ScriptingAdditions/Digital Hub Scripting.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist. 
osascript: OpenScripting.framework - scripting addition "/System/Library/ScriptingAdditions/StandardAdditions.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist. 
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist. 
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/pC Finder Injector.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist. 
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/SIMBL.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist. 
syntax error -1757. Couldn't get error text because of error -1757. 

を?

+0

あなたの説明は混乱しています。なぜフォルダが再び開くのですか?それは10秒にどのように関連していますか?ログファイルはどのように作成されますか?あなたは、バックグラウンドプロセスが何をしているかは言及していません'-f'を' pkill'と一緒に使用しない方がいいです。なぜならあなたは完全なコマンドラインではなく_name_というプロセスにマッチしているからです。 – mklement0

答えて

-1

それだけスクリプトためDo shell script作品と思われる(私は.commandファイルは、スクリプトを明らかにしませ考えることだろうと思った。)

osascriptを内のファイルを.command使用する場合は、私がしなければなりませんでしたエラーなしの場合は以下のようになります。

nohup osascript -e 'tell application "Terminal" to do script "'"$DIR"'/Documents.command"' 

Terminalが働いたとtell applicationトリガーを使用して!

+0

'do shell script'はその引数を'/bin/sh -c'に渡します。したがって、 '.command'ファイルが実行可能で有効なシバン行を持ち、ファイル名が引用されていれば、必要に応じて動作するはずです。 'echo'を試してくださいecho hi '> t.command; chmod + x t.command; osascript -e 'シェルスクリプト "./t.command"' '。 'tell application"ターミナル "スクリプトを実行する"ターミナルを起動し、(起動しなくても)ウィンドウでスクリプトを実行します。 – mklement0

関連する問題