在你shell腳本,你執行
osascript -e 'Tell application "Terminal" to do script "osascript ~/Scripts/reset_simulator.applescript"'
真正打開一個新的窗口Terminal.app。
你有什麼特別的理由打開一個新的終端窗口嗎?爲什麼不從你的shell腳本和當前窗口運行
osascript ~/Scripts/reset_simulator.applescript
。
但是如果你想這樣的事情(對我聽起來怪)總是可以用下一:
osascript -e 'Tell application "Terminal" to do script "osascript ~/Scripts/reset_simulator.applescript;exit"'
#note the "exit" here ---------------------------------------------------------------------------------^^^^^
和改變首選項「關閉窗口」 shell退出時。
閱讀你上面的評論,聽起來比你想在「背景」中運行一些applescript。從你的shell腳本
osascript ~/Scripts/reset_simulator.applescript &
2)
一)如果您想還是打開另一個終端窗口
osascript -e 'Tell application "Terminal" to do script "osascript ~/Scripts/reset_simulator.applescript&exit"'
#note the & here --------------------------------------------------------------------------------------^
我試着在沒有終端的情況下運行它,但是這個shell腳本是從TeamCity buildagent調用的,並且存在一些隱私/安全問題,不會讓applescript運行。 – 2014-09-10 20:00:39
@ deluded12ga - 所以,我添加了另一個選項(見出口)。但是要明白,只有當'reset_simulator.applescript'完成時'exit'纔會被執行,正如@nneonneo在上面的評論中所說的那樣。 – jm666 2014-09-10 20:02:06
非常感謝你! – 2014-09-10 20:04:25