Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.3: Colored output from 'ls' (revisited)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Colored output from 'ls' (revisited)
Authored by: flunkedflank on Oct 31, '03 01:27:37PM

By the way, as the submitter of this hint, I'll throw in one more bonus, not necessarily for the faint-of-heart. I have a colored prompt as well, enabled as such in .cshrc:

set prompt = "%{\033[30;43m%}%~ %%%{\033[0m%} "

I find colored prompts invaluable, as they make it easy to visually distinguish between the output of multiple commands. (Got hooked on it from xwsh on IRIX that used a yellow prompt by default.)

Dig through "man tcsh" and find the definition of the prompt variable. You'll find:

%{string%} - Includes string as a literal escape sequence.

The color settings are determined by the numbers between "\033[" (ESC-[) and "m". They are defined as such:

# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white

Any combination of numbers can be used, separated by a semicolon. So in my case I have "30;43", which means black text on a yellow background. Then I reset it to normal with the "0" value at the end.

Mmm ... gotta love terminal escape sequence crap.



[ Reply to This | # ]