summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-07-20 06:40:42 +0000
committerMike Frysinger <vapier@gentoo.org>2006-07-20 06:40:42 +0000
commit3e1b5789ec9b8fff575bbedfab8c156e25165289 (patch)
tree60461e7643535556c4084fb4f215e5b2a1830813 /app-shells
parentx86 is landlocked =/ (diff)
downloadgentoo-2-3e1b5789ec9b8fff575bbedfab8c156e25165289.tar.gz
gentoo-2-3e1b5789ec9b8fff575bbedfab8c156e25165289.tar.bz2
gentoo-2-3e1b5789ec9b8fff575bbedfab8c156e25165289.zip
Enable histappend option by default #139609 by Trenton D. Adams and add small rewrite by Michael A. Smith to use bash builtins instead of grep for detecting term color capabilities #140266.
(Portage version: 2.1.1_pre3-r1)
Diffstat (limited to 'app-shells')
-rw-r--r--app-shells/bash/ChangeLog7
-rw-r--r--app-shells/bash/files/bashrc20
2 files changed, 18 insertions, 9 deletions
diff --git a/app-shells/bash/ChangeLog b/app-shells/bash/ChangeLog
index abcc21d41e08..8b22d2f354b1 100644
--- a/app-shells/bash/ChangeLog
+++ b/app-shells/bash/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for app-shells/bash
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.105 2006/07/20 02:18:12 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/ChangeLog,v 1.106 2006/07/20 06:40:42 vapier Exp $
+
+ 20 Jul 2006; Mike Frysinger <vapier@gentoo.org> files/bashrc:
+ Enable histappend option by default #139609 by Trenton D. Adams and add
+ small rewrite by Michael A. Smith to use bash builtins instead of grep for
+ detecting term color capabilities #140266.
20 Jul 2006; Mike Frysinger <vapier@gentoo.org> files/dot-bashrc:
Only run dircolors on /etc/DIR_COLORS if /etc/DIR_COLORS exists #140628.
diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc
index fa3103e312a1..c4a352484611 100644
--- a/app-shells/bash/files/bashrc
+++ b/app-shells/bash/files/bashrc
@@ -20,20 +20,24 @@ fi
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
+# Enable history appending instead of overwriting. #139609
+shopt -s histappend
+
# 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.
+# first to take advantage of user additions. Use internal bash
+# globbing instead of external grep binary.
use_color=false
-safe_term=${TERM//[^[:alnum:]]/.} # sanitize TERM
-
+safe_term=${TERM//[^[:alnum:]]/.} # sanitize TERM
if [[ -f /etc/DIR_COLORS ]] ; then
- grep -q "^TERM ${safe_term}" /etc/DIR_COLORS && use_color=true
+ match_lhs=$(</etc/DIR_COLORS)
elif type -p dircolors >/dev/null ; then
- if dircolors --print-database | grep -q "^TERM ${safe_term}" ; then
- use_color=true
- fi
+ match_lhs=$(dircolors --print-database)
+else
+ match_lhs=""
fi
+[[ $'\n'${match_lhs} == *$'\n'"TERM ${safe_term}"* ]] && use_color=true
if ${use_color} ; then
if [[ ${EUID} == 0 ]] ; then
@@ -51,4 +55,4 @@ else
fi
# Try to keep environment pollution down, EPA loves us.
-unset use_color safe_term
+unset use_color safe_term match_lhs