GNU屏幕-从shell或脚本在后台运行命令中创建屏幕 [英] GNU Screen - create screen in background run command from shell or script
本文介绍了GNU屏幕-从shell或脚本在后台运行命令中创建屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从shell创建screen
会话/窗口并在其中启动命令.我该怎么办?
I am trying to create a screen
session/window from the shell and launch a command in it. How would I do that?
推荐答案
如果要启动并连接到屏幕:
If you want to launch and connect to screen:
screen CMD
如果要启动但不连接到屏幕:
If you want to launch and not connect to screen:
screen -dm CMD
也适用于会话:
screen -Sdm NewDetachedSessionName CMD
您可以使用stuff
将按键发送到CMD
:
You can send keypresses to CMD
with stuff
:
screen -S NewDetachedSessionName -X stuff "keypresses"
要发送换行,请在按键中包含\n
或^M
或$'\n'
.
To send a new-line, include \n
or ^M
or $'\n'
with the keypresses.
这篇关于GNU屏幕-从shell或脚本在后台运行命令中创建屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文