echo -ne “${none}”使用编辑器执行命令时每隔一行
从 shell 编辑器 ctrl-x e
发出命令时,我遇到了 echo -ne "${none}"
显示每隔一行的问题,
例如输入 <代码> for i 发生了什么事? ;回显“$i”;完成 将打印出
echo -ne "${none}"
echo -ne "${none}"
what
echo -ne "${none}"
echo -ne "${none}"
is
echo -ne "${none}"
echo -ne "${none}"
going
echo -ne "${none}"
echo -ne "${none}"
on
echo -ne "${none}"
echo -ne "${none}"
R
我不太确定发生了什么。它似乎对事物没有影响,但使读取输出变得有点痛苦。
所以我想我已经弄清楚为什么我只从编辑器中得到“echo -ne "${none}"”。
我已经编辑了我的 .bashrc,包含来自 https:// 的花哨的 bash 提示 github.com/andresgongora/synth-shell 。为我的 bash 提示符着色。
############################################################################
## BASH PROMT ##
## Generate promt and remove format from the rest ##
############################################################################
PS1="$TITLEBAR\n${PROMT_USER}${SEPARATOR_1}${PROMT_HOST}${SEPARATOR_2}${PROMT_PWD}${SEPARATOR_3}${PROMT_INPUT}"
## For terminal line coloring, leaving the rest standard
none="$(tput sgr0)"
trap 'echo -ne "${none}"' DEBUG
我假设从编辑器输入命令不会设置 none 变量
I've been having an issue with echo -ne "${none}"
displaying every other line when issuing commands from the shell editor ctrl-x e
For example entering for i in what is going on ? ; do echo "$i"; done
will print out
echo -ne "${none}"
echo -ne "${none}"
what
echo -ne "${none}"
echo -ne "${none}"
is
echo -ne "${none}"
echo -ne "${none}"
going
echo -ne "${none}"
echo -ne "${none}"
on
echo -ne "${none}"
echo -ne "${none}"
R
I'm not really sure what's going on. It doesn't seem to have an effect on things, but makes reading the output kind of a pain.
So I think I've worked out why I am getting the 'echo -ne "${none}"' only from editor.
I have edited my .bashrc do include the fancy bash prompt from https://github.com/andresgongora/synth-shell . do colourise my bash prompt.
############################################################################
## BASH PROMT ##
## Generate promt and remove format from the rest ##
############################################################################
PS1="$TITLEBAR\n${PROMT_USER}${SEPARATOR_1}${PROMT_HOST}${SEPARATOR_2}${PROMT_PWD}${SEPARATOR_3}${PROMT_INPUT}"
## For terminal line coloring, leaving the rest standard
none="$(tput sgr0)"
trap 'echo -ne "${none}"' DEBUG
I assume that entering commands from the editor doesn't set the none variable
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议检查您的
bash
非交互式外壳启动/终止过程。似乎每次调用非相互作用的外壳命令并终止您接收
echo -ne“ $ {none}”
建议1
一个技巧来识别包括
echo -ne的当前bash函数
:此命令将在每个
echo -ne
命令上方打印20行。建议2
检查bash启动/终止脚本:
建议3
粗体,字体,...
,它可能不支持您的终端(颜色,
检查外壳提示的配置
ps1
当您仅使用文本会话(TUI)而没有GUI时,是一致的。如果此问题仅在GUI环境中出现,则您的终端
TTY
配置和/或提示PS1
有配置问题。I suggest to inspect your
bash
non-interactive shell initiation/termination process.It seems each time a non-interactive shell command is called and terminated you receive
echo -ne "${none}"
Suggestion 1
One trick to identify the current bash functions that includes
echo -ne
:This command will print the 20 lines above each
echo -ne
command.Suggestion 2
Inspect bash initiation/termination scripts:
Suggestion 3
Check configuration of your shell prompt
PS1
, it might be unsupported by your terminal (colors, bolds, fonts,...)Suggestion 4
Test if this behavior is consistent when you are using text only session (TUI) without GUI.
If this problem appears only in GUI environment you have configuration problem with your terminal
TTY
configuration and/or promptPS1
.