2 ms·
Almost forgot: Under xterm, at least, ^V is the escape character and ^[ is ESC, so you can type things like: $ echo '^[[0m^[[01;32mfoo^[[0m' with a ^V before
by derleth 14y ago
Almost forgot: Under xterm, at least, ^V is the escape character and ^[ is ESC, so you can type things like:
$ echo '^[[0m^[[01;32mfoo^[[0m'
with a ^V before every ^[ (the ^V doesn't get echoed back to you unless you type ^V^V to enter a single ^V). That makes 'foo' bold and lime green.
Once you learn how to read a terminfo file, you can do everything your terminal is capable of (and xterm can do quite a bit) entirely by typing control codes by hand. Which is pointless, given that tput, from the ncurses package, does the same thing in a much more user-friendly way that's also completely terminal-independent.
http://en.wikipedia.org/wiki/Ncurses http://en.wikipedia.org/wiki/Ncurses
http://www.gnu.org/software/ncurses/ncurses.html http://www.gnu.org/software/ncurses/ncurses.html
http://en.wikipedia.org/wiki/Tput http://en.wikipedia.org/wiki/Tput
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html -- Explicitly about using tput, which really is a neat way to make your shell script's output look nice.
- dhimes 14y agoWell, I guess that about makes thoughts of doing anything useful the rest of today pointless....This is way too fun.