On Mon, 20 Mar 2006 tony.little at comcast.net wrote: > I was investigating how my copy of knoppix works, and as I was reading > the file 'knoppix-autoconfig' I found these variables with some weird > strings being assigned to them: > > # ANSI COLORS > CRE="^M^[[K" > NORMAL="^[[0;39m" > # RED: Failure or error message > RED="^[[1;31m" > # GREEN: Success message > GREEN="^[[1;32m" > # YELLOW: Descriptions > YELLOW="^[[1;33m" > # BLUE: System messages > BLUE="^[[1;34m" > # MAGENTA: Found devices or drivers > MAGENTA="^[[1;35m" > # CYAN: Questions > CYAN="^[[1;36m" > # BOLD WHITE: Hint > WHITE="^[[1;37m" > > > Later on in the script they are used like this: > > KERNEL="$(uname -r)" > echo "${GREEN}Running Linux Kernel ${YELLOW}$KERNEL${GREEN}.${NORMAL}" > > > In another script I found something similar: > > echo -e "\033[31m $VENDOR_TEXT \033[0m" > > I believe the \033 is an escape sequence and the 31 means red, but I'm > not sure. I'm wondering is 31 the entire symbol or is it [31m that is > the symbol? The \033 is the ascii character with octal code 33, which is the escape character. Check this out: man ascii The "backslash number" is a common way of expressing certain special characters in shell scripts (tr, perl, and a few others work with those octal codes). Apparently the ESC character followed by [31m tell the shell to display in red. Try these commands: ls -l --color /lib | less ls -l --color /lib | less -r The first one shows the ANSI color codes with the ESC characters and the second command interprets those characters to display the color. > I can tell that these are modifiers for the color of the text but I > whould like to know which part does what and where can I find a > definition of these? The thing you are interested in is "ANSI color." Here's some information about how it is used in bash: http://www.linuxfocus.org/English/May2004/article335.shtml Mike