diff options
author | 2007-01-04 23:44:41 +0000 | |
---|---|---|
committer | 2007-01-04 23:44:41 +0000 | |
commit | 775a6a85888f1da4a9902e75a95dce00279b8cd8 (patch) | |
tree | 51bb46b721a0529f3e799a01c7481051f2d78c72 /app-shells/bash/files | |
parent | Bug 160127, keywording ~amd64 (diff) | |
download | gentoo-2-775a6a85888f1da4a9902e75a95dce00279b8cd8.tar.gz gentoo-2-775a6a85888f1da4a9902e75a95dce00279b8cd8.tar.bz2 gentoo-2-775a6a85888f1da4a9902e75a95dce00279b8cd8.zip |
Add more support for BSD systems.
(Portage version: 2.1.2_rc4-r5)
Diffstat (limited to 'app-shells/bash/files')
-rw-r--r-- | app-shells/bash/files/bashrc | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc index b6fee4df9e22..be1bec629c88 100644 --- a/app-shells/bash/files/bashrc +++ b/app-shells/bash/files/bashrc @@ -23,6 +23,21 @@ shopt -s checkwinsize # Enable history appending instead of overwriting. #139609 shopt -s histappend +# Change the window title of X terminals +case ${TERM} in + xterm*|rxvt*|Eterm|aterm|kterm|gnome) + PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' + ;; + screen) + PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' + ;; +esac +#BSD#@# BSD doesn't typically come with dircolors so we need +#BSD#@# to be lame and hardcode some terminals in here. +#BSD#@case ${TERM} in +#BSD#@ xterm*|rxvt*|Eterm|aterm|kterm|gnome|screen|cons25) use_color=true;; +#BSD#@esac + # 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 @@ -33,16 +48,20 @@ safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM match_lhs="" [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)" -[[ -z ${match_lhs} ]] && match_lhs=$(dircolors --print-database) +[[ -z ${match_lhs} ]] \ + && type -p dircolors >/dev/null #BSD#@ \ + && match_lhs=$(dircolors --print-database) [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true if ${use_color} ; then # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 - if [[ -f ~/.dir_colors ]] ; then - eval $(dircolors -b ~/.dir_colors) - elif [[ -f /etc/DIR_COLORS ]] ; then - eval $(dircolors -b /etc/DIR_COLORS) - fi + if type -p dircolors >/dev/null ; then#BSD#@ + if [[ -f ~/.dir_colors ]] ; then + eval $(dircolors -b ~/.dir_colors) + elif [[ -f /etc/DIR_COLORS ]] ; then + eval $(dircolors -b /etc/DIR_COLORS) + fi + fi#BSD#@ if [[ ${EUID} == 0 ]] ; then PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' @@ -64,13 +83,3 @@ fi # Try to keep environment pollution down, EPA loves us. unset use_color safe_term match_lhs - -# Change the window title of X terminals -case ${TERM} in - xterm*|rxvt*|Eterm|aterm|kterm|gnome) - PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' - ;; - screen) - PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' - ;; -esac |