Sunday, May 31, 2009

color prompt


# Define colors for readability
black="\[\033[0;30;49m\]"
blackgrey="\[\033[30;47m\]"
red="\[\033[1;31;49m\]"
green="\[\033[32;49m\]"
yellow="\[\033[33;49m\]"
blue="\[\033[1;34;49m\]"
magenta="\[\033[35;49m\]"
cyan="\[\033[36;49m\]"
white="\[\033[37;49m\]"
r_color="\[\033[0m\]" # Reset color
clr="\[\033[K\]" # Clear to the end of the line

if [ ${UID} -eq 0 ]; then
user="$red\u$r_color"
else
user="$blue\u$r_color"
fi

PS1="$user@\h:\w\$ "