[ILUG] Colour in Prompt ($PS1)

kernel v2.0.35 kernel at tinet.ie
Fri Sep 10 21:30:38 IST 1999


-----Original Message-----
From: zeris <zeris at zeris.net>
To: ilug at linux.ie <ilug at linux.ie>
Date: 07 September 1999 11:53
Subject: Re: [ILUG] Colour in Prompt ($PS1)


>* Breathnach, Proinnsias(Dublin) (breatpro at MLE.CO.UK) [990906 10:39]:
>hi,
>there is a BASH prompt how to.
>http://www.linuxdoc.org/HOWTO/Bash-Prompt-HOWTO.html
>
>but an example would be:
>export PS1='[\[\033[33m\]\u\[\033[39m\]@\[\033[32m\]\h\[\033[39m\] \w ]\$ '
>my non-root prompt,
>and
>export PS1='[\[\033[31m\]\u\[\033[39m\]@\[\033[32m\]\h\[\033[39m\] \w ]\$ '
>would be a fetching red 'root' coloured.
>
>--
>Irish Linux Users' Group: ilug at linux.ie
>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
>List maintainer: listmaster at linux.ie
>

just a bit of a followup really...

incidently, taken too far, this can really make to console look UGLY

anyway, basically there are further ways to wierdify your prompt...
using the example zeris gave...specifically the [31m\] type parts...which
control the colour and more - you can actually have three fields in this
taking the format:
[attribute;foreground;backgroundm\]

various possibilities are as follows:

attribute                colour                foreground
background
==================================================
0 none                    black                    30
40
1 bold                     red                        31
41
4 underline             green                    32
42
5 blink                     yellow                   33
43
7 inverse                blue                       34
44
8 invisible               magenta               35
45
                                cyan                      36
46
                                white                     37
           47



anyway, that's it, don't have too much fun :)

Ross Lynch





More information about the ILUG mailing list