diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-07-20 06:40:42 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-07-20 06:40:42 +0000 |
commit | 3e1b5789ec9b8fff575bbedfab8c156e25165289 (patch) | |
tree | 60461e7643535556c4084fb4f215e5b2a1830813 /app-shells/bash/files | |
parent | x86 is landlocked =/ (diff) | |
download | gentoo-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/bash/files')
-rw-r--r-- | app-shells/bash/files/bashrc | 20 |
1 files changed, 12 insertions, 8 deletions
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 |