简体   繁体   中英

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.

In the Linux console with linux term capabilities, printing the escape code \x1b[4m causes the following characters to be printed in blue.

How do I print underlined text in a Linux console?

When I mention "linux" or "xterm" term capabilities I'm talking about the output of $echo $TERM .

Instead of \x1b[4m , try $(tput smul)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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