alex-environ/home/.bash_profile.d/prompt
2022-01-02 18:55:32 +00:00

58 lines
1,012 B
Text

# If not running interactively, don't do anything else
[[ $- != *i* ]] && return
# 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\]'
#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
;;
vesta)
trail=🍓
;;
rukbat)
trail=🍓
;;
esac
fi
export PS1="${pre}${c1}\u@\h${NC} ${c2}\w ${trail}${NC} "