summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Griffis <agriffis@gentoo.org>2004-08-19 01:31:20 +0000
committerAron Griffis <agriffis@gentoo.org>2004-08-19 01:31:20 +0000
commit3f40eebc03d0a8ead928cb9d1cfe4de4d09e1079 (patch)
tree868c8b2aab512edb1a57581a64971ee4ccfc6585 /app-shells
parentPPC stable profile update (diff)
downloadhistorical-3f40eebc03d0a8ead928cb9d1cfe4de4d09e1079.tar.gz
historical-3f40eebc03d0a8ead928cb9d1cfe4de4d09e1079.tar.bz2
historical-3f40eebc03d0a8ead928cb9d1cfe4de4d09e1079.zip
grep /etc/DIR_COLORS for terminals instead of running dircolors #59937
Diffstat (limited to 'app-shells')
-rw-r--r--app-shells/bash/Manifest2
-rw-r--r--app-shells/bash/files/bashrc18
2 files changed, 16 insertions, 4 deletions
diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest
index d239dd401abf..08286f3e1a32 100644
--- a/app-shells/bash/Manifest
+++ b/app-shells/bash/Manifest
@@ -6,7 +6,7 @@ MD5 6a2f5ace1a2dd30b1bee55eba1509027 bash-2.05b-r10.ebuild 3041
MD5 4a3ebcb995491c2730d156b314cbab0b files/bash-3.0-etc-inputrc.patch 1223
MD5 3b905c7c9341c9009bd68f14c047815e files/bash-2.05b-rbash.patch 804
MD5 694b8b1e47e4743e78ee5f7515f76542 files/bash-3.0-posixtrap.patch 789
-MD5 bf31cdbb653a9ad17112633172d243be files/bashrc 948
+MD5 8424d47516cd474034c956a1cde0cafa files/bashrc 1335
MD5 4383b25cd54b24b9f459e338f06d096c files/bash-2.05b-parallel-build.patch 459
MD5 582fb9ed0ca44627978ce6836a5000dc files/config-top.h.diff 487
MD5 96238e7d942d091ca71574ba7392e847 files/bash-3.0-array-stripping.patch 294
diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc
index 0490253fc209..2d69fc92cc28 100644
--- a/app-shells/bash/files/bashrc
+++ b/app-shells/bash/files/bashrc
@@ -1,5 +1,5 @@
# /etc/bash.bashrc:
-# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/files/bashrc,v 1.3 2004/08/14 03:10:00 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/files/bashrc,v 1.4 2004/08/19 01:31:20 agriffis Exp $
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
@@ -14,8 +14,20 @@ if [[ $- != *i* ]]; then
return
fi
-# Set colorful PS1 only on colorful terminals
-if dircolors --print-database | grep -Fqx "TERM $TERM"; then
+# Set colorful PS1 only on colorful terminals.
+# dircolors --print-database uses its own built-in database
+# instead of using /etc/DIR_COLORS. Try to use the external file
+# first to take advantage of user additions.
+use_color=false
+safe_term=${TERM//[^[:alnum:]]/.} # sanitize TERM
+
+if [[ -f /etc/DIR_COLORS ]]; then
+ grep -q "^TERM ${safe_term}" /etc/DIR_COLORS && use_color=true
+elif dircolors --print-database | grep -q "^TERM ${safe_term}"; then
+ use_color=true
+fi
+
+if ${use_color}; then
if [[ $EUID == 0 ]]; then
PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
else