Date: Thu, 18 Sep 2008 08:06:39 +0100 From: Frank Shute <frank@shute.org.uk> To: Anselm Strauss <amsibamsi@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: bash shell colors Message-ID: <20080918070639.GA20237@melon.esperance-linux.co.uk> In-Reply-To: <544E50BF-EE1B-466A-A152-03AFA7688FAF@gmail.com> References: <11167f520809172208g655640b0w9a5ad0deb2e44f7e@mail.gmail.com> <544E50BF-EE1B-466A-A152-03AFA7688FAF@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080918070639.GA20237>
