2009-11-21 73 views
5

我可以創建一個(非常)簡單的蘋果腳本應用程序來運行Firefox背景&退出。 (原因是我有不同的工作&家庭配置文件)。我的劇本基本上是:爲什麼Applescript在後臺Shell作業後退出?

做shell腳本 「/Applications/firefox.app/Contents/MacOS/firefox -no遠程-P '個人' &」

它的工作原理,但腳本/應用程序不會退出,直到我退出Firefox。我該如何解決這個問題?

回答

12

您需要將stdout和stderr重定向到某處。 執行shell腳本命令知道它爲程序的stdout和stderr設置的管道仍處於打開狀態,因此它將等待它們關閉。

do shell script "/Applications/firefox.app/Contents/MacOS/firefox -no-remote -P 'Personal' > /dev/null 2>&1 &"