source: trunk/debathena/debathena/dotfiles/bashrc @ 23030

Revision 23030, 4.3 KB checked in by ghudson, 16 years ago (diff)
In dotfiles: * Restore the cdpath and prompt customizations for tcsh. * Eliminate the noclobber and ignoreeof customizations for bash. * Add /sbin and /usr/sbin to the path for both shell types.
Line 
1# Global bashrc file
2#
3# $Id: bashrc,v 1.39 2006-07-17 23:14:07 rbasch Exp $
4
5# This file is sourced by default user file ~/.bashrc
6
7initdir=/usr/lib/init
8
9# add alias moved here to avoid having two copies of it.
10
11add () { eval "$( /bin/attach -Padd -b "$@" )" ; }
12
13
14# *******************   ENVIRONMENT SETUP   *******************
15
16
17
18# Set up standard system/user environment configuration (including setup of
19# environment variables, attachment of lockers, and setting of search path)
20
21# If we see ENV_SET set to empty, we could be a tcsh user who has
22# decided to run bash, or we could be a bash user suffering from the
23# misfeature that the standard xsession script runs the tcsh dotfiles
24# for all users.  Running the environment setup for the former
25# category of user would be unfriendly (it resets the homedir and
26# changes the path), so for now, only run environment setup for bash
27# users.  If the xsession problem is ever fixed, change this
28# conditional to check for '"${ENV_SET+set}" != set' and eliminate the
29# shell check.
30if [ "${ENV_SET:+set}" != set -a "${SHELL##*/}" = bash ]; then
31
32        export ENV_SET=t                        # Avoid unnecessary repeat
33        export HOSTTYPE="`/bin/machtype`"
34
35        if [ -r "$HOME/.generation" ]; then
36                export ATHENA_DOTFILE_GENERATION=`cat "$HOME/.generation"`
37        else
38                export ATHENA_DOTFILE_GENERATION=0
39        fi
40
41        umask 077                               # Strictly protect files
42                                                #  (does not apply in AFS)
43        ulimit -S -c 0                          # Don't allow coredumps
44        export EDITOR=emacs                     # Set default editor
45        export VISUAL=emacs                     # Set default screen editor
46        export MM_CHARSET=iso-8859-1
47
48        export MORE=-s
49
50        # Set double-sided printing for sufficiently recent users.
51        if [ 1 -le "$ATHENA_DOTFILE_GENERATION" ]; then
52                export LPROPT=-Zduplex
53        fi
54
55        export ATHENA_SYS=`/bin/machtype -S`
56        export ATHENA_SYS_COMPAT=`/bin/machtype -C`
57
58        if [ -z "$ATHENA_SYS" ]; then
59                export ATHENA_SYS=@sys
60        fi
61
62        if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then
63                PRINTER=`awk '/LPR/ { print $3 }' /var/athena/clusterinfo`
64                if [ -n "$PRINTER" ]; then export PRINTER; fi
65        fi
66
67        # Reset the HOME variable to correspond to the actual location
68        # of the user's home directory.  This will avoid having long
69        # pathnames being printed when /mit/<user> is a symlink to a
70        # path within AFS.
71
72        x=`(cd && /bin/pwd) 2>/dev/null`
73        if [ -n "$x" ]; then
74                export HOME=$x
75                if [ "$x" = "`/bin/pwd`" ]; then
76                        cd "$HOME"
77                fi
78        fi
79        unset x
80
81        # Although it's contrary to theory, there is useful stuff in
82        # /sbin and /usr/sbin, and we've traditionally had it in the
83        # default path.
84        PATH=${PATH}:/sbin:/usr/sbin
85
86        # Run user environment customizations identified in your
87        # ~/.bash_environment file.  This is the place to include your
88        # own environment variables, attach commands, and other system
89        # wide setup commands.  You can also cancel default behaviors
90        # listed above.
91        # ~/.bash_environment is not sourced if NOCALLS is set (i.e.,
92        # if you selected the xlogin "Ignore your customizations"
93        # option when you logged in).
94
95        if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then
96                . ~/.bash_environment
97        fi
98
99        # If the user has a bindir in $HOME, put it in front of the path.
100        athena_home_bin=$( /usr/bin/athdir "$HOME" )
101        PATH=${athena_home_bin:+$athena_home_bin:}$PATH
102        unset athena_home_bin
103
104fi
105
106
107# *******************  BASH SETUP   *******************
108
109# Set up standard bash shell initializations
110
111#   alias for re-establishing authentication
112renew () { kinit -54 $USER && fsid -a && zctl load /dev/null ; }
113
114#   alias for a convenient way to change terminal type
115term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; }
116
117#   aliases dealing with x window system
118xresize () { set -f; eval "$( resize -u )"; set +f ; }
119
120if [ "${XSESSION+set}" = set ]; then
121        if [ -z "$XSESSION" ]; then
122                logout () { end_session && exit; }              # logout for X
123        else
124                logout () { kill -HUP $XSESSION && exit; }      # logout for X
125        fi
126fi
127
128#   aliases dealing with adding locker programs
129
130alias setup='echo "setup is not supported in bash yet"'
131
132
133# All of the bash initializing commands above can be overridden by using
134# "unset" or "unalias" commands (or by changing things using "set" or
135# "alias" again) in your ~/.bashrc.mine file, which is sourced here.
136# ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations"
137# option was selected to begin the session.
138
139if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then
140        . ~/.bashrc.mine
141fi
Note: See TracBrowser for help on using the repository browser.