在 ssh 之前导出 TERM
我在笔记本电脑上使用 TERM='xterm-256color'
,但必须在 xterm-256color
的远程服务器上使用 TERM='xterm'
code> 不可用并且破坏了一些东西。
到目前为止我可以做 export TERM='xterm'; ssh -X 123.45.678.90
,效果很好。但是将上一行放入 (zsh
) 别名 (alias sshx="export TERM='xterm'; ssh -X 123.45.678.90"
) 似乎并不工作。例如,如果我在 export
和 ssh
之间插入 echo $TERM
,则在命令行中执行的所有操作都会回显 xterm
code>,但别名为 xterm-256color
。
当然,最佳情况是,TERM
在 ssh
之后被设置回其初始值。
有办法实现这一点吗?
谢谢。
I'm using TERM='xterm-256color'
on my laptop but have to use TERM='xterm'
on a remote server where xterm-256color
is not available and breaks down a few things.
So far I can do export TERM='xterm'; ssh -X 123.45.678.90
, which works fine. But putting the previous line in an (zsh
) alias (alias sshx="export TERM='xterm'; ssh -X 123.45.678.90"
) doesn't seem to work. E.g., if I insert a echo $TERM
between the export
and the ssh
, doing everything in the command line echoes xterm
, but the alias gives xterm-256color
.
And of course, optimally, the TERM
would be set back to its initial value after the ssh
.
Is there a way to achieve this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常可以通过
不导出任何内容来解决。在其他情况下,您可能必须创建一个函数。
It is normally solved by
without exporting anything. In other case you will probably have to create a function.