Add: Shorten usernames in prompt

This commit is contained in:
Gerrit Pannek 2017-11-03 09:46:24 +01:00
parent 93292f5f46
commit e366960520

10
bashrc
View file

@ -1,10 +1,18 @@
# Change prompt if root
if [ $UID -eq 0 ] ; then if [ $UID -eq 0 ] ; then
PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]' PROMPT_SUFFIX='\[\033[1;31m\] # \[\033[0m\]'
else else
PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]' PROMPT_SUFFIX='\[\033[0;32m\] $ \[\033[0m\]'
fi 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 export PATH=$PATH:~/bin:~/local/bin
function tmux_title { function tmux_title {