Reputation: 77
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
.
Upvotes: 1
Views: 1510
Reputation: 26895
Instead of \x1b[4m
, try $(tput smul)
printf "%s\n" "$(tput smul)This is underlined"
Upvotes: 3