Add: Shorten usernames in prompt

This commit is contained in:
Gerrit Pannek 2017-11-03 09:46:24 +01:00
parent 93292f5f46
commit e366960520
1 changed files with 9 additions and 1 deletions

10
bashrc
View File

@ -1,10 +1,18 @@
# Change prompt if root
if [ $UID -eq 0 ] ; then
PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]'
else
PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]'
fi
PS1='\[\033[0;32m\]me@\h\[\033[0m\] [\[\033[0;33m\]\w\[\]\[\033[0;32m\]]'$PROMPT_SUFFIX
# Shorten long usernames
if [ $(whoami | wc -c) -gt 10 ] ; then
USER="me"
else
USER=$(whoami)
fi
PS1='\[\033[0;32m\]${USER}@\h\[\033[0m\] [\[\033[0;33m\]\w\[\]\[\033[0;32m\]]'$PROMPT_SUFFIX
export PATH=$PATH:~/bin:~/local/bin
function tmux_title {