2017-05-12 16 views
-1

두 번 클릭 할 수있는 명령 파일을 실행 중입니다. 파일 이름 : Documents.command 터미널 창을 열지 않고 백그라운드에서 프로세스를 실행합니다. 따라서 터미널 응용 프로그램을 닫으려면 & pkill -f -a Terminal을 사용하고 있습니다.nohup osascript do shell 실행 - 오류 발생

이전에는 작동했지만 이제는 내 문서 폴더가 두 번 이상 열립니다. 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 "터미널은"script to do "터미널을 시작하고 창에서 스크립트를 실행합니다 (활성화하지 않고). – mklement0