File: //etc/profile.d/prompt.sh
# Set up a colorful prompt
ncolors=$(tput colors)
if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]
then
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
reset=$(tput sgr0)
bold=$(tput bold)
# If this is not a root user, we use a green prompt
if [[ $EUID -ne 0 ]]
then
PS1="\[$green\]\u\[$reset\]@\[$cyan\]\h\[$reset\] [\w]\[$green\]\[$bold\]\\$\[$reset\] "
else
# Call some attention that we are root and can do some damage
PS1="\[$magenta\]\[$bold\]\u\[$reset\]@\[$cyan\]\h\[$reset\] [\w]\[$red\]\[$bold\]\\$\[$reset\] "
fi
else
# No color support. Keep it simple.
PS1="\u@\h [\w\]\\$ "
fi