【问题标题】:Application gets closed when terminal is closed, how to stop this?终端关闭时应用程序关闭,如何停止?
【发布时间】:2013-08-16 03:18:51
【问题描述】:

我有一个像这样的期望脚本

#!/usr/bin/expect
spawn /usr/bin/firefox https://www.google.com/

脚本完成后.. 终端自动关闭,这对我来说没问题。

但它也会关闭它打开的 firefox 浏览器。

我需要浏览器保持打开状态。

【问题讨论】:

    标签: python linux bash shell terminal


    【解决方案1】:

    使用nohup 防止子进程在终端关闭时被杀死。

    spawn nohup /usr/bin/firefox https://www.google.com/
    

    我认为脚本还有更多内容,因为不需要使用 Expect 来启动 firefox。

    【讨论】:

      【解决方案2】:

      您是否尝试过以下方法?

      #!/usr/bin/expect
      spawn /usr/bin/firefox https://www.google.com/ \&
      

      #!/usr/bin/expect
      spawn /usr/bin/firefox https://www.google.com/ "&"
      

      【讨论】:

        猜你喜欢
        • 2015-04-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-19
        • 2018-07-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多