将控制字符传递到远程bash shell(替代SSH)

发布于 2025-02-06 20:56:37 字数 576 浏览 1 评论 0原文

我想运行一个完全互动的远程bash壳。

客户端应该能够将命令发送到此bash过程并进行交互方式。

这意味着,就像在本地bash提示符中一样,命令及其尊敬的响应之间的相关性不一定保证,因为在运行另一个命令后,我们可能会从上一个在后台运行的命令中获得输出。

当我运行单独的bash过程并使用管道时,它可以工作:

  1. bash 2>& 1 | Tee文件
  2. bash>文件2>& 1

但是,如果我需要发送控制字符,例如 tab for自动完成或 ctrl+ctrl+c ,以防万一我们要终止当前命令。

听起来可能与SSH协议相似,但是我想尝试使用具有不同访问控制和UI体验的替代远程外壳的选项。

因此,我的问题是:如何将控制字符传递到远程bash过程(例如自动完成)并恢复结果(例如,自动完成选择列表)?

注意:我不希望开发bash等效的shell脚本,而只是构建一个能够传递数据和控制字符的代理过程,并像本地 /SSH模式一样提供无缝的bash体验。

I'd like to run a remote bash shell that is fully interactive.

The client side should be able to send commands to this bash process and get the outputs interactively.

This means that, just like in a local bash prompt, the correlation between commands and their respected responses isn't necessarily guaranteed, since we may get outputs from a previous command that runs in the background, after running another command.

It works when I run separate bash process and use pipes:

  1. bash 2>&1 | tee file
  2. bash > file 2>&1

However, if I need to send control characters like Tab for auto-completion or Ctrl+C, in case we want to terminate the current command.

It may sound similar to SSH protocol, but I'd like to experiment with this option of running an alternative remote shell, with different access control and UI experience.

So, my question is: How do I pass the control character to the remote bash process (for example, the auto-completion) and get back the results (for example, list of choices for auto-completion)?

NOTE: I don't wish to develop bash equivalent shell script, but just build a proxy process that is able to pass both data and control characters and provide seamless bash experience as in local /ssh mode.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文