转义序列]0;

发布于 2025-01-07 23:40:32 字数 391 浏览 4 评论 0原文

我目前正在尝试编写一个使用expect 登录SSH 的脚本。当我使用 xterm 彩色终端时,登录到服务器的每个提示都显示为 [user@host]~/directory$。但是,如果我直接从 SSH 读取输出,我会看到以下 ]0;user@host:~/directory[user@host]~/directory$。使用 export PS1="#-->" 将结果更改为 ]0;user@host:~/directory#-->

我的问题是:序列 ]0; 的作用是什么?它属于哪一类终端?我找不到 VT52 和 VT100 的对应信息。

I am currently trying to write a script that uses expect to logon to SSH. Logging on to a server every prompt appears as [user@host]~/directory$ when I use a xterm color terminal. However, if I read the output from SSH directly with expect I see the following <ESC>]0;user@host:~/directory[user@host]~/directory$. Using export PS1="#-->" changes the result to <ESC>]0;user@host:~/directory#-->.

My question is: What does the sequence <ESC>]0;do? And which class of terminals does it belong to? I could not find it for neither VT52 nor VT100.

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

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

发布评论

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

评论(1

毅然前行 2025-01-14 23:40:32

默认情况下,每个选项卡的标签是该会话中运行的作业的名称。某些系统配置为使用附加信息(例如您登录的主机名或当前目录)来增强此功能;这是通过发送特殊代码来完成的:

ESC]0;<string>^G

例如 ESC]0;david@Scott:~^G,会将“david@Scott:~”放在我的选项卡标题中,

这称为 XTERM 硬状态黑客。

by default, the label of each tab is the name of the job that's running in that session. some systems are configured to augment this with additional information such as the hostname you're logged in to or your current directory; this is done by sending a special code of:

ESC]0;<string>^G

such as, ESC]0;david@Scott:~^G, would put "david@Scott:~" in my tab title

this is referred to as the XTERM hardstatus hack.

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