|
Lines 54-80
Link Here
|
| 54 |
# Set colorful PS1 only on colorful terminals. |
54 |
# Set colorful PS1 only on colorful terminals. |
| 55 |
# dircolors --print-database uses its own built-in database |
55 |
# dircolors --print-database uses its own built-in database |
| 56 |
# instead of using /etc/DIR_COLORS. Try to use the external file |
56 |
# instead of using /etc/DIR_COLORS. Try to use the external file |
| 57 |
# first to take advantage of user additions. Use internal bash |
57 |
# first to take advantage of user additions. |
| 58 |
# globbing instead of external grep binary. |
58 |
if type -P dircolors >/dev/null ; then |
| 59 |
safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM |
59 |
if [[ -f ~/.dir_colors ]] ; then |
| 60 |
match_lhs="" |
60 |
eval $(dircolors -b ~/.dir_colors) |
| 61 |
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" |
61 |
elif [[ -f /etc/DIR_COLORS ]] ; then |
| 62 |
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)" |
62 |
eval $(dircolors -b /etc/DIR_COLORS) |
| 63 |
[[ -z ${match_lhs} ]] \ |
63 |
fi |
| 64 |
&& type -P dircolors >/dev/null \ |
64 |
[[ "x$LS_COLORS" != "x" ]] && use_color=true |
| 65 |
&& match_lhs=$(dircolors --print-database) |
65 |
fi |
| 66 |
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true |
66 |
|
| 67 |
|
67 |
|
| 68 |
if ${use_color} ; then |
68 |
if ${use_color} ; then |
| 69 |
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489 |
|
|
| 70 |
if type -P dircolors >/dev/null ; then |
| 71 |
if [[ -f ~/.dir_colors ]] ; then |
| 72 |
eval $(dircolors -b ~/.dir_colors) |
| 73 |
elif [[ -f /etc/DIR_COLORS ]] ; then |
| 74 |
eval $(dircolors -b /etc/DIR_COLORS) |
| 75 |
fi |
| 76 |
fi |
| 77 |
|
| 78 |
if [[ ${EUID} == 0 ]] ; then |
69 |
if [[ ${EUID} == 0 ]] ; then |
| 79 |
PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' |
70 |
PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' |
| 80 |
else |
71 |
else |