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 | |
---|
7 | initdir=/usr/lib/init |
---|
8 | |
---|
9 | # add alias moved here to avoid having two copies of it. |
---|
10 | |
---|
11 | add () { 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. |
---|
30 | if [ "${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 EMAIL="$USER@mit.edu" # Set default email address |
---|
49 | |
---|
50 | export MORE=-s |
---|
51 | |
---|
52 | # Set double-sided printing for sufficiently recent users. |
---|
53 | if [ 1 -le "$ATHENA_DOTFILE_GENERATION" ]; then |
---|
54 | export LPROPT=-Zduplex |
---|
55 | fi |
---|
56 | |
---|
57 | export ATHENA_SYS=`/bin/machtype -S` |
---|
58 | export ATHENA_SYS_COMPAT=`/bin/machtype -C` |
---|
59 | |
---|
60 | if [ -z "$ATHENA_SYS" ]; then |
---|
61 | export ATHENA_SYS=@sys |
---|
62 | fi |
---|
63 | |
---|
64 | if [ "${PRINTER+set}" != set \ |
---|
65 | -a -e /var/run/athena-clusterinfo.sh ]; then |
---|
66 | PRINTER=`awk '/LPR/ { print $3 }' \ |
---|
67 | /var/run/athena-clusterinfo.sh` |
---|
68 | if [ -n "$PRINTER" ]; then export PRINTER; fi |
---|
69 | fi |
---|
70 | |
---|
71 | # Reset the HOME variable to correspond to the actual location |
---|
72 | # of the user's home directory. This will avoid having long |
---|
73 | # pathnames being printed when /mit/<user> is a symlink to a |
---|
74 | # path within AFS. |
---|
75 | |
---|
76 | x=`(cd && /bin/pwd) 2>/dev/null` |
---|
77 | if [ -n "$x" ]; then |
---|
78 | export HOME=$x |
---|
79 | if [ "$x" = "`/bin/pwd`" ]; then |
---|
80 | cd "$HOME" |
---|
81 | fi |
---|
82 | fi |
---|
83 | unset x |
---|
84 | |
---|
85 | # Run user environment customizations identified in your |
---|
86 | # ~/.bash_environment file. This is the place to include your |
---|
87 | # own environment variables, attach commands, and other system |
---|
88 | # wide setup commands. You can also cancel default behaviors |
---|
89 | # listed above. |
---|
90 | # ~/.bash_environment is not sourced if NOCALLS is set (i.e., |
---|
91 | # if you selected the xlogin "Ignore your customizations" |
---|
92 | # option when you logged in). |
---|
93 | |
---|
94 | if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then |
---|
95 | . ~/.bash_environment |
---|
96 | fi |
---|
97 | |
---|
98 | # If the user has a bindir in $HOME, put it in front of the path. |
---|
99 | athena_home_bin=$( /usr/bin/athdir "$HOME" ) |
---|
100 | PATH=${athena_home_bin:+$athena_home_bin:}$PATH |
---|
101 | unset athena_home_bin |
---|
102 | |
---|
103 | fi |
---|
104 | |
---|
105 | |
---|
106 | # ******************* BASH SETUP ******************* |
---|
107 | |
---|
108 | # Set up standard bash shell initializations |
---|
109 | |
---|
110 | # alias for re-establishing authentication |
---|
111 | renew () { kinit -54 $USER && fsid -a && zctl load /dev/null ; } |
---|
112 | |
---|
113 | # alias for a convenient way to change terminal type |
---|
114 | term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; } |
---|
115 | |
---|
116 | # aliases dealing with x window system |
---|
117 | xresize () { set -f; eval "$( resize -u )"; set +f ; } |
---|
118 | |
---|
119 | if [ "${XSESSION+set}" = set ]; then |
---|
120 | logout () { gnome-session-save --kill --silent; exit; } # logout for X |
---|
121 | fi |
---|
122 | |
---|
123 | # aliases dealing with adding locker programs |
---|
124 | |
---|
125 | alias setup='echo "setup is not supported in bash yet"' |
---|
126 | |
---|
127 | |
---|
128 | # All of the bash initializing commands above can be overridden by using |
---|
129 | # "unset" or "unalias" commands (or by changing things using "set" or |
---|
130 | # "alias" again) in your ~/.bashrc.mine file, which is sourced here. |
---|
131 | # ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations" |
---|
132 | # option was selected to begin the session. |
---|
133 | |
---|
134 | if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then |
---|
135 | . ~/.bashrc.mine |
---|
136 | fi |
---|