bash shell colors

Frank Shute frank at shute.org.uk
Thu Sep 18 07:06:52 UTC 2008


On Thu, Sep 18, 2008 at 08:56:09AM +0200, Anselm Strauss wrote:
>
> Hi,
> 
> I use something like this (heavily inspired by Gentoo):
> 
> if [[ ${EUID} == 0 ]] ; then
>   PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
> else
>   PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
> fi
> 
> One could maybe also include a check of $TERM for different terminal  
> types, not all of them will understand color escape sequences. And of  
> course tools like ls and grep do colorized output themselves when  
> called with appropriate options.
> 
> This is described in the PROMPTING section of Bash's manpage. I did  
> not find any documentation for the exact codes for ANSI color escape  
> sequences.
> 

The ANSI color escape codes are shown here:

http://www.understudy.net/custom.html#table2

I don't know if they're in any FreeBSD documentation.

Regards,

-- 

 Frank 


 Contact info: http://www.shute.org.uk/misc/contact.html 



More information about the freebsd-questions mailing list