Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 572582 | Differences between
and this patch

Collapse All | Expand All

(-)bashrc.1 (-20 / +12 lines)
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
	LS_COLORS=""
60
match_lhs=""
60
	if [[ -f ~/.dir_colors ]] ; then
61
[[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
61
		eval $(dircolors -b ~/.dir_colors)
62
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
62
	elif [[ -f /etc/DIR_COLORS ]] ; then
63
[[ -z ${match_lhs}    ]] \
63
		eval $(dircolors -b /etc/DIR_COLORS)
64
	&& type -P dircolors >/dev/null \
65
	&& match_lhs=$(dircolors --print-database)
66
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
67
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
64
	fi
65
	[[ -n "$LS_COLORS" ]] && use_color=true
66
fi
77
67
68
69
if ${use_color} ; then
78
	if [[ ${EUID} == 0 ]] ; then
70
	if [[ ${EUID} == 0 ]] ; then
79
		PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
71
		PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
80
	else
72
	else
Lines 99-105 Link Here
99
done
91
done
100
92
101
# Try to keep environment pollution down, EPA loves us.
93
# Try to keep environment pollution down, EPA loves us.
102
unset use_color safe_term match_lhs sh
94
unset use_color sh
103
95
104
# Own additions:
96
# Own additions:
105
97

Return to bug 572582