为什么';后台Shell作业后是否退出Applescript?

为什么';后台Shell作业后是否退出Applescript?,applescript,Applescript,我可以创建一个(非常)简单的applescript应用程序来运行Firefox后台和退出。(原因是我有不同的工作和家庭档案)。我的剧本基本上是: 执行shell脚本 “/Applications/firefox.app/Contents/MacOS/firefox -无远程-P“个人”和“ 它可以工作,但脚本/应用程序在我退出Firefox之前不会退出。如何解决这个问题?您需要将stdout和stderr重定向到某个地方。do shell script命令知道它为程序的stdout和stderr

我可以创建一个(非常)简单的applescript应用程序来运行Firefox后台和退出。(原因是我有不同的工作和家庭档案)。我的剧本基本上是:

执行shell脚本 “/Applications/firefox.app/Contents/MacOS/firefox -无远程-P“个人”和“


它可以工作,但脚本/应用程序在我退出Firefox之前不会退出。如何解决这个问题?

您需要将stdout和stderr重定向到某个地方。do shell script命令知道它为程序的stdout和stderr设置的管道仍然处于打开状态,因此它会等待它们关闭

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