Page 1 of 1

color in console

PostPosted: Tue May 20, 2008 9:56 am
by charizan
Add the following into .bashrc. Please make a backup of .bashrc in case that you may a mistake or something!

function setprompt
{
local RED="\[$(tput setaf 1)\]"
local RESET="\[$(tput sgr0)\]"
if [ `id -u` = 0 ] # check if user is root
then
PS1="$RED[\u@\h:\W]$RESET "
else
PS1="[\u@\h:\W]$RESET "
fi
}
setprompt