dots/91-tick/profile
2019-02-22 13:13:19 +11:00

47 lines
843 B
Bash

function fg_color
{
if [ -n "$1" ]; then
echo -n "\\[\\033[01;${1}m\\]"
else
echo -n "\\[\\033[00m\\]"
fi
}
RED=$(fg_color 31)
GREEN=$(fg_color 32)
YELLOW=$(fg_color 33)
BLUE=$(fg_color 34)
RESET=$(fg_color)
case "${SESSION_TYPE}" in
remote\/*) PROMPT_COLOUR=${YELLOW};;
*) PROMPT_COLOUR=${GREEN};;
esac
function prompt_command {
res=$?
PS1=""
if [ -n "$VIRTUAL_ENV" ]; then
PS1="($(basename $VIRTUAL_ENV)) "
fi
PS1="${PS1}$(fg_color 32)${USER:-$(whoami 2>/dev/null)}"
PS1="${PS1}@"
PS1="${PS1}${PROMPT_COLOUR}$(uname -n 2>/dev/null) \$ "
PS1="${PS1}$(fg_color 34)"
if [ $res == "0" ]; then
PS1="$PS1"
else
PS1="$PS1"
fi
PS1="$PS1\w \$\[\033[00m\] "
PS1="${PS1}$(fg_color)"
}
export PROMPT_COMMAND=prompt_command