在屏幕会话中向活动程序发送命令?
我有一个服务器在屏幕会话中运行,我想向该程序发送一个命令。我认为 screen -X 是我的答案,但我只能访问 screen 命令(标题、exec 等)。
我需要能够发送命令,就像我将其输入到程序中一样。有什么想法吗?
I've got a server running inside a screen session, and I want to send this program a command. I thought screen -X was my answer, but all that gives me access to is screen commands (title, exec, etc).
I need to be able to send the command as if I was typing it into the program. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将
screen
的-p
和-X
选项与exec
命令结合使用。尝试 screen -X exec ".\!\!" echo foo,例如,将“foo”发送到屏幕中当前运行的程序。
您可能还想尝试 screen -X exec ".!" echo foo 如果第一个命令不起作用。
You may use
screen
's-p
and-X
options in conjunction with theexec
command.Try
screen -X exec ".\!\!" echo foo
, for example, to send "foo" to the currently-running program in the screen.You might also want to try
screen -X exec ".!" echo foo
if the first command is not working.