Skip to content

Instantly share code, notes, and snippets.

@jasonaowen
Created August 27, 2015 23:41
Show Gist options
  • Save jasonaowen/acc2f4955e7ab2bbf0cf to your computer and use it in GitHub Desktop.
Save jasonaowen/acc2f4955e7ab2bbf0cf to your computer and use it in GitHub Desktop.
PS1
case $TERM in
xterm*|cygwin*|screen)
termstr='\[\033]0;\h:\w\007\]'
;;
*)
;;
esac
function promptreturn { ret=$?; if test "$ret" = "0"; then echo -e "\e[1;32m$ret"; else echo -e "\e[1;31m$ret"; fi; unset ret; }
clock="\[\e[1;31m\]\@"
if test "$UID" = "0"; then
back="\[\e[0;31m\]"
else
back="\[\e[1;34m\]"
fi
fore="\[\e[0;36m\]"
temp=`tty`
loc=`echo ${temp:5}`
PS1="${termstr}${back}[${clock}${back}] [\[\e[0;35m\]${loc}${back}] [${fore}return: \$(promptreturn)${back}] [\[\e[1;35m\]\w${back}]\n${back}[${fore}\h${back}]\\$\[\e[0m\] "
unset temp termstr back fore loc clock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment