diff --git a/home/.bash_profile.d/prompt b/home/.bash_profile.d/prompt index 9ca457a..0c63eaa 100644 --- a/home/.bash_profile.d/prompt +++ b/home/.bash_profile.d/prompt @@ -1,7 +1,52 @@ # If not running interactively, don't do anything else [[ $- != *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} "