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

Revision 25379, 4.0 KB checked in by jdreed, 11 years ago (diff)
In dotfiles: * Update logout alias for GNOME 3.0 (Trac: #1027)
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# Determine if we're in an sftp or scp session and if so, be quiet
10SILENT=no
11case "$BASH_EXECUTION_STRING" in
12    */usr/lib/openssh/sftp-server)
13        SILENT=yes
14        ;;
15    scp\ *)
16        SILENT=yes
17        ;;
18esac
19
20# *******************   ENVIRONMENT SETUP   *******************
21
22# Set up standard system/user environment configuration (including setup of
23# environment variables, attachment of lockers, and setting of search path)
24
25if [ "${ENV_SET:+set}" != set ]; then
26
27        export ENV_SET=t                        # Avoid unnecessary repeat
28        export HOSTTYPE="`/bin/machtype`"
29
30        # Ensure user's homedir is attached, for legacy things
31        # that care about attachtab
32        # Only attach if running as an Athena user, not e.g. using sudo.
33        if [ "$DEBATHENA_HOME_TYPE" = afs ]; then
34                /bin/attach -h -q "${ATHENA_USER:-$USER}"
35        fi
36
37        if [ -r "$HOME/.generation" ]; then
38                export ATHENA_DOTFILE_GENERATION=`cat "$HOME/.generation"`
39        else
40                export ATHENA_DOTFILE_GENERATION=0
41        fi
42
43        ulimit -S -c 0                          # Don't allow coredumps
44        export EDITOR=emacs                     # Set default editor
45        export MM_CHARSET=iso-8859-1
46
47        export EMAIL="$USER@mit.edu"            # Set default email address
48
49        export MORE=-s
50
51        export ATHENA_SYS=`/bin/machtype -S`
52        export ATHENA_SYS_COMPAT=`/bin/machtype -C`
53
54        if [ -z "$ATHENA_SYS" ]; then
55                export ATHENA_SYS=@sys
56        fi
57
58        if [ "${PRINTER+set}" != set \
59          -a -e /var/run/athena-clusterinfo.csh ]; then
60                PRINTER=`awk '/LPR/ { print $3 }' \
61                  /var/run/athena-clusterinfo.csh`
62                if [ -n "$PRINTER" ]; then export PRINTER; fi
63        fi
64
65        # Reset the HOME variable to correspond to the actual location
66        # of the user's home directory.  This will avoid having long
67        # pathnames being printed when /mit/<user> is a symlink to a
68        # path within AFS.
69
70        x=`(cd && /bin/pwd) 2>/dev/null`
71        if [ -n "$x" ]; then
72                export HOME=$x
73                if [ "$x" = "`/bin/pwd`" ]; then
74                        cd "$HOME"
75                fi
76        fi
77        unset x
78
79        # Run user environment customizations identified in your
80        # ~/.bash_environment file.  This is the place to include your
81        # own environment variables, attach commands, and other system
82        # wide setup commands.  You can also cancel default behaviors
83        # listed above.
84        # ~/.bash_environment is not sourced if NOCALLS is set (i.e.,
85        # if you selected the xlogin "Ignore your customizations"
86        # option when you logged in).
87
88        if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then
89            if [ "$SILENT" = "yes" ]; then
90                . ~/.bash_environment &> /dev/null
91            else
92                . ~/.bash_environment
93            fi
94        fi
95
96        # If the user has a bindir in $HOME, put it in front of the path.
97        athena_home_bin=$( /usr/bin/athdir "$HOME" )
98        PATH=${athena_home_bin:+$athena_home_bin:}$PATH
99        unset athena_home_bin
100
101fi
102
103
104# *******************  BASH SETUP   *******************
105
106# Set up standard bash shell initializations
107
108if [ "${XSESSION+set}" = set ]; then
109   if [ -x /usr/bin/gnome-session-quit ]; then
110        logout () { gnome-session-quit --no-prompt; exit; } # logout for X
111   else   
112        logout () { gnome-session-save --kill --silent; exit; } # logout for X
113   fi
114fi
115
116#   aliases dealing with adding locker programs
117
118setup_tty () {(export SUBJECT="$@"; $SHELL)}
119setup_X () {(export SUBJECT="$@"; xterm -title "$@" &)}
120
121if [ -n "$XSESSION" ]; then
122   alias setup=setup_X
123else
124   alias setup=setup_tty
125fi
126
127remove () { export SUBJECT="$@";
128            source $initdir/env_remove.bash;
129            unset SUBJECT; }
130
131if [ -n "$SUBJECT" -a -r $initdir/env_setup.bash ]; then
132        source $initdir/env_setup.bash
133fi
134
135
136# All of the bash initializing commands above can be overridden by using
137# "unset" or "unalias" commands (or by changing things using "set" or
138# "alias" again) in your ~/.bashrc.mine file, which is sourced here.
139# ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations"
140# option was selected to begin the session.
141
142if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then
143    if [ "$SILENT" = "yes" ]; then
144        . ~/.bashrc.mine &> /dev/null
145    else
146        . ~/.bashrc.mine
147    fi
148fi
Note: See TracBrowser for help on using the repository browser.