Better prompt colors

This commit is contained in:
Alex Manning 2022-01-02 11:19:40 +00:00
parent ab6158bcd7
commit 734af9a9ce

View file

@ -1,7 +1,52 @@
# If not running interactively, don't do anything else # If not running interactively, don't do anything else
[[ $- != *i* ]] && return [[ $- != *i* ]] && return
# add a fancy colored prompt. may be best to copy and alter colors for machine Identification # Color mapping
grey='\[\033[1;30m\]'
red='\[\033[0;31m\]'
RED='\[\033[1;31m\]'
green='\[\033[0;32m\]'
GREEN='\[\033[1;32m\]'
yellow='\[\033[0;33m\]'
YELLOW='\[\033[1;33m\]'
purple='\[\033[0;35m\]'
PURPLE='\[\033[1;35m\]'
white='\[\033[0;37m\]'
WHITE='\[\033[1;37m\]'
blue='\[\033[0;34m\]'
BLUE='\[\033[1;34m\]'
cyan='\[\033[0;36m\]'
CYAN='\[\033[1;36m\]'
NC='\[\033[0m\]'
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] ' #Default colors.
c1=$GREEN
c2=$BLUE
trail='\$'
pre=''
# RED if logged in as root.
if [ "$EUID" -eq 0 ]
then
c1=$RED
trail='#'
# Toolbox
elif [ -f /run/.containerenv ] && [ -f /run/.toolboxenv ]
then
trail='🔧'
c1=$YELLOW
else
# Per-machine colors.
case `hostname -s` in
polaris)
c1=$BLUE
c2=$CYAN
;;
arcadia)
c1=$CYAN
c2=$GREEN
;;
esac
fi
export PS1="${pre}${c1}\u@\h${NC} ${c2}\w ${trail}${NC} "