GNU Screen - create screen in background run command from shell or script

白昼怎懂夜的黑 提交于 2019-11-29 07:12:17

问题


I am trying to create a screen session/window from the shell and launch a command in it. How would I do that?


回答1:


If you want to launch and connect to screen:

screen CMD

If you want to launch and not connect to screen:

screen -dm CMD

Works with sessions too:

screen -Sdm NewDetachedSessionName



回答2:


first create new session :

screen -dmS [session_name]

then attach command or script to run in session created :

screen -x [session_name] [script.sh]



来源:https://stackoverflow.com/questions/11491700/gnu-screen-create-screen-in-background-run-command-from-shell-or-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!