dots/bash/title_prompt
2009-01-14 22:12:11 -05:00

24 lines
476 B
Text
Executable file

function do_prompt ()
{
if [ $? -ne 0 ] ; then
local ERROR_PROMPT="\[\033[01;31m\]"
fi
local BASE
if [ $UID -ne 0 ] ; then
BASE="$"
else
BASE="#"
fi
case $TERM in
xterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=''
;;
esac
export PS1="${TITLEBAR}\[\033[01;32m\]\u@\h \[\033[01;34m\]\w ${ERROR_PROMPT}${BASE} \[\033[00m\]"
}
PROMPT_COMMAND=do_prompt