mirror of
https://github.com/NaomiAmethyst/dots.git
synced 2025-04-13 09:30:06 +00:00
34 lines
777 B
Text
Executable file
34 lines
777 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
|
|
|
|
local TITLEBAR
|
|
case $TERM in
|
|
xterm*|*rxvt*|cygwin|interix|Eterm|mlterm|kterm|aterm|putty*)
|
|
if [ "${STY}" ] ; then
|
|
TITLEBAR='\[\033k\u@\h:\w\033\134\]'
|
|
else
|
|
TITLEBAR='\[\033]1;\u@\h:\w\007\033]2;\u@\h:\w\007\]'
|
|
fi
|
|
;;
|
|
screen*)
|
|
TITLEBAR='\[\033k\u@\h:\w\033\134\]'
|
|
;;
|
|
*)
|
|
TITLEBAR=''
|
|
;;
|
|
esac
|
|
PS1="${TITLEBAR}\[\033[01;32m\]\u@\h \[\033[01;34m\]\w ${ERROR_PROMPT}${BASE} \[\033[00m\]"
|
|
export PS1
|
|
}
|
|
|
|
PROMPT_COMMAND=do_prompt
|