Last active
February 15, 2016 18:00
-
-
Save rlaager/054151496a9da89aa8e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unlike upstream, we use dircolors instead of tput to determine which types of | |
# terminals support colors. Otherwise, we can end up with an inconsistency | |
# between bash and ls, et al. For example: a vt100 on OpenIndiana. | |
if which dircolors > /dev/null 2>&1 && \ | |
dircolors --print-database 2> /dev/null | grep -q "^TERM $TERM$" | |
then | |
# Colorize based on hostname: green, yellow, blue, magenta, or cyan. | |
ps_h='\[\e[1;'$((32 + $(hostname | cut -d. -f1 | cksum | cut -c1-3) % 5))'m\]\h\[\e[0m\]' | |
if [ "$(id -u)" = "0" ] | |
then | |
# Make the username and # red when logged in as root. | |
PS1='${debian_chroot:+($debian_chroot)}\[\e[1;31m\]\u\[\e[0m\]@'$ps_h':\w\[\e[0;31m\]\$\[\e[0m\] ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@'$ps_h':\w\$ ' | |
fi | |
unset ps_h | |
if [ -r ~/.dircolors ] | |
then | |
eval "$(dircolors -b ~/.dircolors)" | |
else | |
eval "$(dircolors -b)" | |
fi | |
alias ls='ls --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment