1 if test "${OS}" != gentoo
5 # Set colorful PS1 only on colorful terminals.
6 # dircolors --print-database uses its own built-in database
7 # instead of using /etc/DIR_COLORS. Try to use the external file
8 # first to take advantage of user additions. Use internal bash
9 # globbing instead of external grep binary.
10 safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM
12 [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
13 [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
14 [[ -z ${match_lhs} ]] \
15 && type -P dircolors >/dev/null \
16 && match_lhs=$(dircolors --print-database)
17 [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
19 if ${use_color} ; then
20 # Enable colors for ls, etc. Prefer ~/.dir_colors #64489
21 if type -P dircolors >/dev/null ; then
22 if [[ -f ~/.dir_colors ]] ; then
23 eval $(dircolors -b ~/.dir_colors)
24 elif [[ -f /etc/DIR_COLORS ]] ; then
25 eval $(dircolors -b /etc/DIR_COLORS)
29 if [[ ${EUID} == 0 ]] ; then
30 PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
32 PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
35 if [[ ${EUID} == 0 ]] ; then
36 # show root@ when we don't have colors
43 # Try to keep environment pollution down, EPA loves us.
44 unset use_color safe_term match_lhs