命令发送到GNU屏幕 [英] Send commands to a GNU screen

查看:82
本文介绍了命令发送到GNU屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GNU屏幕演示命名,我想将命令发送到它。我该怎么做呢?

I have a GNU screen named demo, I want to send commands to it. How do I do this?

screen -S demo -X /home/aa/scripts/outputs.sh

yeilds 无屏幕会话中。

和做屏幕-ls 显示,它没有运行。

and doing screen -ls shows that it isn't running.

推荐答案

如果屏幕会话没有运行,您将无法送东西给它。首先启动它。

If the Screen session isn't running, you won't be able to send things to it. Start it first.

一旦你得到了一个会议,你需要屏幕的命令和键盘输入区别开来。 屏幕-X 期望一个屏幕命令。在的东西命令发送的输入,如果你想从shell提示下运行该程序,你必须通过一个换行符也是如此。

Once you've got a session, you need to distinguish between Screen commands and keyboard input. screen -X expects a Screen command. The stuff command sends input, and if you want to run that program from a shell prompt, you'll have to pass a newline as well.

screen -S demo -X stuff '/home/aa/scripts/outputs.sh
'

请注意,这可能是错误的做法。你确定要输入到无论是在该届会议上活跃?直接输入在一个特定的窗口,使用

Note that this may be the wrong approach. Are you sure you want to type into whatever is active in that session? To direct the input at a particular window, use

screen -S demo -p 1 -X stuff '/home/aa/scripts/outputs.sh
'

1代表窗口号(可以使用,而不是它的标题)。

where 1 is the window number (you can use its title instead).

要启动该会话的新窗口,使用屏幕命令。 (这就是屏幕屏幕命令,而不是屏幕 shell命令。)

To start a new window in that session, use the screen command instead. (That's the screen Screen command, not the screen shell command.)

screen -S demo -p 1 -X screen '/home/aa/scripts/outputs.sh'

这篇关于命令发送到GNU屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆