当我在〜/ .bash_profile中设置导出TERM = xterm-256color时,我遇到了很奇怪的问题.当我尝试运行nano或emacs时,我收到以下错误.
纳米:
.rror opening terminal: xterm-256color
emacs的:
is not defined.type xterm-256color If that is not the actual type of terminal you have, use the Bourne shell command `TERM=... export TERM' (C-shell: `setenv TERM ...') to specify the correct type. It may be necessary to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.
如果我在shell中手动输入以下内容就可以了
export TERM=xterm-256color
我很难过.
看起来你的DOS中有DOS换行符.bash_profile
.不要在Windows上编辑文件,和/或使用适当的工具将它们复制到Linux系统.
更好的是,摆脱Windows.
更详细地说,您可能无法看到它,但错误的行实际上是读取的
export TERM=xterm-256color^M
^M
文字DOS回车在哪里.
就像@EtanReisner在评论中提到的那样,你不应该在登录文件中对这个值进行硬编码.Linux会非常努力地将其设置为合理的值,具体取决于您实际使用的终端以及连接方式.最多,您可能希望覆盖登录过程经常选择但不符合您的喜好的特定值.假设您想要更改为xterm-256color
iff值为xterm
:
case $TERM in xterm) TERM=xterm-256color;; esac
这不是一个编程问题,而是StackOverflow上一个非常常见的问题.请先询问谷歌.