[Gllug] Coloured bash prompt

Tethys tet at createservices.com
Thu Apr 22 14:21:28 UTC 2004


Richard Cohen writes:

>COLOR1="\[\033[0;36m\]"
>COLOR2="\[\033[0;32m\]"
>COLOR3="\[\033[0;36m\]"
>COLOR4="\[\033[0;37m\]"

Bleurgh! Remember, "the whole world is not a VT100". Or in this
particular case, the whole world doesn't support ANSI escape
sequences. Try instead:

	colour1=$(tput setf 3)
	colour2=$(tput setf 2)
	colour3=$(tput setf 3)
	colour4=$(tput setf 7)

That'll work, no matter which terminal you're on. Plus it has the
added benefit of not cluttering up your rc scripts with line noise...

Tet
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list