Magellan Linux

Contents of /trunk/bash/bashrc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (show annotations) (download)
Mon Jul 25 17:26:38 2005 UTC (18 years, 9 months ago) by niro
File size: 1774 byte(s)
new file

1 # /etc/bash/bashrc - System-wide bashrc
2 # $Header: /root/magellan-cvs/src/bash/bashrc,v 1.1 2005-07-25 17:26:21 niro Exp $
3
4 # This file is sourced by all *interactive* bash shells on startup,
5 # including some apparently interactive shells such as scp and rcp
6 # that can't tolerate any output. So make sure this doesn't display
7 # anything or bad things will happen !
8
9
10 # Test for an interactive shell. There is no need to set anything
11 # past this point for scp and rcp, and it's important to refrain from
12 # outputting anything in those cases.
13 if [[ $- != *i* ]] ; then
14 # Shell is non-interactive. Be done now!
15 return
16 fi
17
18 # Bash won't get SIGWINCH if another process is in the foreground.
19 # Enable checkwinsize so that bash will check the terminal size when
20 # it regains control. #65623
21 # http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
22 shopt -s checkwinsize
23
24 # Set colorful PS1 only on colorful terminals.
25 # dircolors --print-database uses its own built-in database
26 # instead of using /etc/DIR_COLORS. Try to use the external file
27 # first to take advantage of user additions.
28 use_color=false
29 safe_term=${TERM//[^[:alnum:]]/.} # sanitize TERM
30
31 if [[ -f /etc/DIR_COLORS ]]
32 then
33 grep -q "^TERM ${safe_term}" /etc/DIR_COLORS && use_color=true
34 elif type -p dircolors >/dev/null
35 then
36 if dircolors --print-database | grep -q "^TERM ${safe_term}"
37 then
38 use_color=true
39 fi
40 fi
41
42 if ${use_color}
43 then
44 if [[ ${EUID} == 0 ]]
45 then
46 PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
47 else
48 PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
49 fi
50 else
51 if [[ ${EUID} == 0 ]]
52 then
53 # show root@ when we don't have colors
54 PS1='\u@\h \W \$ '
55 else
56 PS1='\u@\h \w \$ '
57 fi
58 fi
59
60 # Try to keep environment pollution down, EPA loves us.
61 unset use_color safe_term
62