Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#!/bin/bash
_set_prompt () {
local exit=$?
#local black="30";
#local grey="31";
local red="31";
local green="32";
local yellow="33";
#local blue="34";
#local purple="35";
local cyan="36";
local white="37";
local pre="\[\e[";
local suf="\]";
# public values
GREEN="${pre}0;${green}m$suf";
#BLUE="${pre}0;${blue}m$suf";
CYAN="${pre}0;${cyan}m$suf";
WHITE="${pre}0;${white}m$suf";
#BWHITE="$pre$white;1m$suf";
BRED="$pre$red;1m$suf";
#YELLOW="${pre}0;${yellow}m$suf";
BYELLOW="$pre$yellow;1m$suf";
NORMAL="\[\e[0;0m\]"
local u;
local p;
if [ "$UID" = "0" ]; then
u="$BRED\u$NORMAL";
p="$BRED#$NORMAL";
else
u="$BYELLOW\u$NORMAL";
p="%";
fi
_prompt="[$WHITE\h$NORMAL:$CYAN\w$NORMAL] $u $p ";
}
_update_prompt () {
local exit="$?"
local bul="\342\200\242" # bullet character
case "$exit" in
"0" ) ex="$GREEN$bul$NORMAL " ;;
* ) ex="$BRED$bul$NORMAL " ;;
esac
export PS1="$ex$_prompt";
}
_set_prompt
PROMPT_COMMAND='_update_prompt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.