我正在尝试在 emacs 中使用 ansi-term(配置为 tcsh shell)。我看到显示换行符的一些问题。如果我从终端(ansi-term)尝试以下操作,我会得到正确的输出:
myterm > echo "Line1"; echo "Line2"; echo "Line3";
Line1
Line2
Line3
myterm >
但是,如果我尝试将相同的行放在 shell 脚本中并尝试从 ansi-term 执行脚本,我会得到错误的输出
脚本:(测试)
#!/usr/bin/env tcsh
echo "Line1"; echo "Line2"; echo "Line3";
运行脚本(测试):
myterm > ./test
Line1
Line2
Line3
myterm >
注意:/usr/bin/env tcsh 确实指向正确的 shell(它与我在调用 ansi-term 时使用的 shell 相同)。同样从 gnome-terminal 执行脚本也会显示正确的输出。我也尝试设置以下变量,但它没有解决我的问题:
(set-terminal-coding-system 'utf-8-unix)
(setq default-process-coding-system '((utf-8-unix . utf-8-unix)))