That's plain ASCII, nothing special about it. The \x08
is ASCII code for backspace so the first one does H-backspace-HE-backspace-E... (writes every character twice) and the second does H-backspace-_ and so on. It's what you would do on a typewriter to get bold and underline.
On the other hand, to handle color, you output ASCII escape codes that are interpreted by the virtual terminal to show color, blink, position cursor and so on. It's how commands like ls
write in color:
http://en.wikipedia.org/wiki/ANSI_escape_sequences
To allow less
to preserve the ASCII escape codes, you call it as less -R
. For instance, this command displays ls
output in color in less
:
/bin/ls --color -B -F -1 | less -R
Which I have as alias to lsl
.
\b
on a terminal doesn't delete the character, it's just that inH\b_
,_
replaces the H (it's_
that deletesH
, not\b
). Also note that there are Unicode underlining combining characters nowadays so another way to write an underlinedH
is to write aH
followed by U+0332 likeH̲
. (which my firefox doesn't render properly btw). – Stéphane Chazelas Mar 08 '14 at 18:54