summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-05-26 22:07:59 +0000
committerMike Frysinger <vapier@gentoo.org>2005-05-26 22:07:59 +0000
commitde912bf361db91b699ce6b0e9cf73a5c4c5a5d11 (patch)
treec3efca1242e1de49f881f0780fec9fa834872736 /app-shells/bash/files/bashrc
parentremove forced ncompress DEPEND and make bzip2 optional (diff)
downloadgentoo-2-de912bf361db91b699ce6b0e9cf73a5c4c5a5d11.tar.gz
gentoo-2-de912bf361db91b699ce6b0e9cf73a5c4c5a5d11.tar.bz2
gentoo-2-de912bf361db91b699ce6b0e9cf73a5c4c5a5d11.zip
make sure dircolors exist before we try to run it ... good for BSD
(Portage version: 2.0.51.22-r1)
Diffstat (limited to 'app-shells/bash/files/bashrc')
-rw-r--r--app-shells/bash/files/bashrc18
1 files changed, 10 insertions, 8 deletions
diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc
index 77a6bd2d5f88..e15d7f8fba55 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.5 2004/09/28 11:50:23 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-shells/bash/files/bashrc,v 1.6 2005/05/26 22:07:59 vapier Exp $
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
@@ -9,7 +9,7 @@
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
-if [[ $- != *i* ]]; then
+if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now
return
fi
@@ -27,20 +27,22 @@ shopt -s checkwinsize
use_color=false
safe_term=${TERM//[^[:alnum:]]/.} # sanitize TERM
-if [[ -f /etc/DIR_COLORS ]]; then
+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
+elif type -p dircolors >/dev/null ; then
+ if dircolors --print-database | grep -q "^TERM ${safe_term}" ; then
+ use_color=true
+ fi
fi
-if ${use_color}; then
- if [[ $EUID == 0 ]]; then
+if ${use_color} ; then
+ if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
else
PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\w \$ \[\033[00m\]'
fi
else
- if [[ $EUID == 0 ]]; then
+ if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else