[使用转义序列"\033[21m"
用于重置/删除粗体/明亮:
echo -e "Text\033[1mMore text\033[21mEnd"
必须返回:
文本更多文本结束
但我知道
文本更多文本 E̲n̲d̲
如您所见,在xterm
中将"\033[21m"
更改为下划线并重置为粗体,我们需要使用"\033[0m"
,为什么?
是否可以更改此行为? (也许使用某些参数启动xterm)
根据XTerm Control Sequences,SGR 21被“双下划线”:
CSI Pm m Character Attributes (SGR).
Ps = 2 1 -> Doubly-underlined (ISO 6429).
Ps = 2 2 -> Normal (neither bold nor faint).
Ps = 2 3 -> Not italicized (ISO 6429).
Ps = 2 4 -> Not underlined.
Ps = 2 5 -> Steady (not blinking).
Ps = 2 7 -> Positive (not inverse).
Ps = 2 8 -> Visible, i.e., not hidden (VT300).
Ps = 2 9 -> Not crossed-out (ISO 6429).
也许您打算使用SGR 22。
双下划线功能是在xterm patch #305中实现的:
小规模重组以实现“填充” SGR功能。没有建立的应用程序依赖于这些应用程序;有些人觉得他们很有趣。
用于管理图形状态的位与属性位分开。 实现SGR代码2、3、9、21及其相应的重置。 添加配置选项 --disable-wide-attrs
以禁用该功能。