简体   繁体   English

Linux 终端功能的 ASCII 下划线转义码

[英]ASCII underline escape code for Linux terminal capabilities

In a Linux terminal emulator with xterm capabilities, printing the escape code \x1b[4m will make the following characters print with an underline.在具有 xterm 功能的 Linux 终端仿真器中,打印转义码\x1b[4m将使以下字符带有下划线。

In the Linux console with linux term capabilities, printing the escape code \x1b[4m causes the following characters to be printed in blue.在具有 linux 术语功能的 Linux 控制台中,打印转义码\x1b[4m会导致以下字符以蓝色打印。

How do I print underlined text in a Linux console?如何在 Linux 控制台中打印带下划线的文本?

When I mention "linux" or "xterm" term capabilities I'm talking about the output of $echo $TERM .当我提到“linux”或“xterm”术语功能时,我指的是$echo $TERM的 output 。

Instead of \x1b[4m , try $(tput smul)而不是\x1b[4m ,尝试$(tput smul)

printf "%s\n" "$(tput smul)This is underlined"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM