加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

bash – 如何使用命令启动Unix屏幕命令?

发布时间:2020-12-15 19:44:33 所属栏目:安全 来源:网络整理
导读:根据 docs for the Unix “screen” command,您可以在.screenrc中配置它,从一堆默认屏幕开始,每个都运行一个您指定的命令。 这是我的cofig: # Default screensscreen -t "shell_0" 1screen -t "autotest" 2 cd ~/project/contactdb ; autotest 它不会运
根据 docs for the Unix “screen” command,您可以在.screenrc中配置它,从一堆默认屏幕开始,每个都运行一个您指定的命令。

这是我的cofig:

# Default screens
screen -t "shell_0"  1
screen -t "autotest" 2 cd ~/project/contactdb ; autotest

它不会运行autotest命令。我开始运行自动测试的那个窗口在我开始屏幕时立即关闭。

我也试过只是…

screen -t "autotest" 2 cd ~/project/contactdb

结果相同。

我也试过…

screen -t "autotest" 2 ls

同样的结果也是。

在启动时在给定屏幕上运行命令的秘诀是什么?

您的程序正在运行(除了cd之外),它只是在没有父shell的情况下运行,所以一旦完成,它将退出并完成。

你可以做:

screen -t "autotest" 2 bash -c 'cd ~/project/contactdb ; autotest'

产生两个贝壳,但生命可能会继续下去。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读