Make a colour BASH prompt
Here is a sample of a useful and colourful BASH prompt.
#!/bin/bash
#
# Colourful and useful BASH prompt
# Angelo Babudro ispltd.com
# Place this file in /etc/profile.d/ in a modern Linux distribution
# (including Gentoo and RHEL) and it should be run automatically
# at log-in.
Orange=$"\e[01;31;40m"
Green=$"\e[01;32m"
Yellow=$"\e[01;33m"
Blue=$"\e[01;34m"
Cyan=$"\e[01;36;40m"
White=$"\e[01;37m"
Grey=$"\e[00;37;40m"
Reset=$"\e[0m"
RootColour=$"\e[00;30;46m"
if [ -f /etc/server-purpose ]; then
PurposeText="`cat /etc/server-purpose`"
PurposeColour=$"\e[01;31;40m"
fi
if [[ ${EUID} == 0 ]]; then
PS1="\n\[${RootColour}\]r0oT!\[${Grey}\] \H \[${PurposeColour}\]${PurposeText}\[${Reset}${Blue}\] \D{%a %Y-%m-%d %H:%M:%S %Z}\n\[${Yellow}\] \w\n\[${White}\]\$ \[${Reset}\]"
else
PS1="\n\[${Green}\]\u\[${Grey}\]@\h \[${PurposeColour}\]${PurposeText}\[${Reset}${Blue}\] \D{%a %Y-%m-%d %H:%M:%S %Z}\n\[${Yellow}\] \w\n\[${White}\]\$ \[${Reset}\]"
fi
unset Orange Green Yellow Blue Cyan White Grey Reset PurposeColour RootColour PurposeText
#_______________
# vim: ts=3:sw=3