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

Revision 24011, 4.1 KB checked in by broder, 15 years ago (diff)
In dotfiles: * Stop setting umask in dotfiles. (Trac: #368) Patch by Nancy Ouyang
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        ulimit -S -c 0                          # Don't allow coredumps
42        export EDITOR=emacs                     # Set default editor
43        export MM_CHARSET=iso-8859-1
44
45        export EMAIL="$USER@mit.edu"            # Set default email address
46
47        export MORE=-s
48
49        # Set double-sided printing for sufficiently recent users.
50        if [ 1 -le "$ATHENA_DOTFILE_GENERATION" ]; then
51                export LPROPT=-Zduplex
52        fi
53
54        export ATHENA_SYS=`/bin/machtype -S`
55        export ATHENA_SYS_COMPAT=`/bin/machtype -C`
56
57        if [ -z "$ATHENA_SYS" ]; then
58                export ATHENA_SYS=@sys
59        fi
60
61        if [ "${PRINTER+set}" != set \
62          -a -e /var/run/athena-clusterinfo.csh ]; then
63                PRINTER=`awk '/LPR/ { print $3 }' \
64                  /var/run/athena-clusterinfo.csh`
65                if [ -n "$PRINTER" ]; then export PRINTER; fi
66        fi
67
68        # Reset the HOME variable to correspond to the actual location
69        # of the user's home directory.  This will avoid having long
70        # pathnames being printed when /mit/<user> is a symlink to a
71        # path within AFS.
72
73        x=`(cd && /bin/pwd) 2>/dev/null`
74        if [ -n "$x" ]; then
75                export HOME=$x
76                if [ "$x" = "`/bin/pwd`" ]; then
77                        cd "$HOME"
78                fi
79        fi
80        unset x
81
82        # Run user environment customizations identified in your
83        # ~/.bash_environment file.  This is the place to include your
84        # own environment variables, attach commands, and other system
85        # wide setup commands.  You can also cancel default behaviors
86        # listed above.
87        # ~/.bash_environment is not sourced if NOCALLS is set (i.e.,
88        # if you selected the xlogin "Ignore your customizations"
89        # option when you logged in).
90
91        if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then
92                . ~/.bash_environment
93        fi
94
95        # If the user has a bindir in $HOME, put it in front of the path.
96        athena_home_bin=$( /usr/bin/athdir "$HOME" )
97        PATH=${athena_home_bin:+$athena_home_bin:}$PATH
98        unset athena_home_bin
99
100fi
101
102
103# *******************  BASH SETUP   *******************
104
105# Set up standard bash shell initializations
106
107#   alias for re-establishing authentication
108renew () { kinit -54 $USER && fsid -a && zctl load /dev/null ; }
109
110if [ "${XSESSION+set}" = set ]; then
111        logout () { gnome-session-save --kill --silent; exit; } # logout for X
112fi
113
114#   aliases dealing with adding locker programs
115
116setup_tty () {(export SUBJECT="$@"; $SHELL)}
117setup_X () {(export SUBJECT="$@"; xterm -title "$@" &)}
118
119if [ -n "$XSESSION" ]; then
120   alias setup=setup_X
121else
122   alias setup=setup_tty
123fi
124
125remove () { export SUBJECT="$@";
126            source $initdir/env_remove.bash;
127            unset SUBJECT; }
128
129if [ -n "$SUBJECT" -a -r $initdir/env_setup.bash ]; then
130        source $initdir/env_setup.bash
131fi
132
133
134# All of the bash initializing commands above can be overridden by using
135# "unset" or "unalias" commands (or by changing things using "set" or
136# "alias" again) in your ~/.bashrc.mine file, which is sourced here.
137# ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations"
138# option was selected to begin the session.
139
140if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then
141        . ~/.bashrc.mine
142fi
Note: See TracBrowser for help on using the repository browser.