You can also display multiple colors in the same prompt. Add the following function to your ~/.bash_profile
function prompt {
local BLUE="\[\033[0;34m\]"
local DARK_BLUE="\[\033[1;34m\]”
local RED=”\[\033[0;31m\]”
local DARK_RED=”\[\033[1;31m\]”
local NO_COLOR=”\[\033[0m\]”
case $TERM in
xterm*|rxvt*)
TITLEBAR=’\[\033]0;\u@\h:\w\007\]’
;;
*)
TITLEBAR=”"
;;
esac
PS1=”\u@\h [\t]> ”
PS1=”${TITLEBAR}\
$BLUE\u@\h $RED[\t]>$NO_COLOR ”
PS2=’continue-> ‘
PS4=’$0.$LINENO+ ‘
}
You can re-login for the changes to take effect or source the .bash_profile as shown below.
$. ./.bash_profile $ prompt ramesh@dev-db [13:02:13]>