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

(-)bash/bashrc (-20 / +14 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 \
64
	else
65
	&& match_lhs=$(dircolors --print-database)
65
		eval "$(dircolors)"
66
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
66
	fi
67
	[[ -n "$LS_COLORS" ]] && use_color=true
68
fi
69
67
70
68
if ${use_color} ; then
71
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
72
	if [[ ${EUID} == 0 ]] ; then
79
		PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
73
		PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
80
	else
74
	else
Lines 99-105 Link Here
99
done
93
done
100
94
101
# Try to keep environment pollution down, EPA loves us.
95
# Try to keep environment pollution down, EPA loves us.
102
unset use_color safe_term match_lhs sh
96
unset use_color sh
103
97
104
# Own additions:
98
# Own additions:
105
99

Return to bug 572582