在屏幕会话中向活动程序发送命令?

发布于 2024-09-14 19:15:26 字数 124 浏览 2 评论 0原文

我有一个服务器在屏幕会话中运行,我想向该程序发送一个命令。我认为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月亮邮递员 2024-09-21 19:15:26

您可以将 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 the exec 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文