2009-11-21 76 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 &"