1 | # Global bashrc file |
---|
2 | # |
---|
3 | # $Id: bashrc,v 1.28 2003-04-02 15:36:52 ghudson Exp $ |
---|
4 | |
---|
5 | # This file is sourced by default user file ~/.bashrc |
---|
6 | |
---|
7 | initdir=/usr/athena/lib/init |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | # ******************* ENVIRONMENT SETUP ******************* |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | # Set up standard system/user environment configuration (including setup of |
---|
16 | # environment variables, attachment of lockers, and setting of search path) |
---|
17 | |
---|
18 | if [ "${ENV_SET:+set}" != set ]; then |
---|
19 | |
---|
20 | export ENV_SET=t # Avoid unnecessary repeat |
---|
21 | export HOSTTYPE="`/bin/athena/machtype`" |
---|
22 | |
---|
23 | umask 077 # Strictly protect files |
---|
24 | # (does not apply in AFS) |
---|
25 | ulimit -c unlimited # Don't allow coredumps |
---|
26 | export EDITOR=emacs # Set default editor |
---|
27 | export VISUAL=emacs # Set default screen editor |
---|
28 | export MM_CHARSET=iso-8859-1 |
---|
29 | |
---|
30 | # Set standard Athena path variables (generic path for all users). |
---|
31 | # PATH will get set later after .bash_environment is run. |
---|
32 | case "$HOSTTYPE" in |
---|
33 | sgi) |
---|
34 | athena_path=/usr/athena/bin:/usr/athena/etc: |
---|
35 | athena_path=$athena_path:/bin/athena:/usr/sbin:/usr/bsd:/sbin |
---|
36 | athena_path=$athena_path:/usr/bin:/bin:/usr/bin/X11:/usr/etc |
---|
37 | MANPATH=/usr/athena/man:/usr/freeware/catman:/usr/share/catman |
---|
38 | MANPATH=$MANPATH:/usr/share/man:/usr/catman:/usr/man |
---|
39 | ;; |
---|
40 | sun4) |
---|
41 | athena_path=/srvd/patch:/usr/athena/bin:/usr/athena/etc |
---|
42 | athena_path=$athena_path:/bin/athena:/usr/openwin/bin |
---|
43 | athena_path=$athena_path:/usr/openwin/demo:/usr/bin |
---|
44 | athena_path=$athena_path:/usr/ccs/bin:/usr/sbin:/sbin:/usr/ucb |
---|
45 | MANPATH=/usr/athena/man:/usr/openwin/man:/usr/dt/man:/usr/man |
---|
46 | ;; |
---|
47 | linux) |
---|
48 | athena_path=/srvd/patch:/usr/athena/bin:/usr/athena/etc |
---|
49 | athena_path=$athena_path:/bin/athena:/usr/bin:/bin |
---|
50 | athena_path=$athena_path:/usr/X11R6/bin:/usr/athena/etc |
---|
51 | athena_path=$athena_path:/usr/sbin:/sbin |
---|
52 | MANPATH=/usr/athena/man:/usr/share/man:/usr/X11R6/man |
---|
53 | ;; |
---|
54 | *) |
---|
55 | echo "Standard dotfiles do not support system type $HOSTTYPE." |
---|
56 | esac |
---|
57 | export MANPATH |
---|
58 | |
---|
59 | # Default "more" behavior |
---|
60 | case $HOSTTYPE in |
---|
61 | sgi) |
---|
62 | MORE=-se |
---|
63 | ;; |
---|
64 | *) |
---|
65 | MORE=-s |
---|
66 | ;; |
---|
67 | esac |
---|
68 | export MORE |
---|
69 | |
---|
70 | # Set miscellaneous system-dependent variables. |
---|
71 | case $HOSTTYPE in |
---|
72 | sgi) |
---|
73 | # The following set the default error message format |
---|
74 | # to omit the label and severity components, per the |
---|
75 | # standard IRIX /etc/profile. |
---|
76 | export MSGVERB=text:action |
---|
77 | export NOMSGLABEL=1 |
---|
78 | export NOMSGSEVERITY=1 |
---|
79 | ;; |
---|
80 | sun4) |
---|
81 | export LD_LIBRARY_PATH=/usr/athena/lib:/usr/openwin/lib |
---|
82 | export OPENWINHOME=/usr/openwin |
---|
83 | ;; |
---|
84 | linux) |
---|
85 | export LD_LIBRARY_PATH=/usr/athena/lib |
---|
86 | ;; |
---|
87 | esac |
---|
88 | |
---|
89 | export ATHENA_SYS=`/bin/athena/machtype -S` |
---|
90 | export ATHENA_SYS_COMPAT=`/bin/athena/machtype -C` |
---|
91 | |
---|
92 | if [ -z "$ATHENA_SYS" ]; then |
---|
93 | export ATHENA_SYS=@sys |
---|
94 | fi |
---|
95 | |
---|
96 | if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then |
---|
97 | PRINTER=`awk '/LPR/ { print $3 }' /var/athena/clusterinfo` |
---|
98 | if [ -n "$PRINTER" ]; then export PRINTER; fi |
---|
99 | fi |
---|
100 | |
---|
101 | # Reset the HOME variable to correspond to the actual location |
---|
102 | # of the user's home directory. This will avoid having long |
---|
103 | # pathnames being printed when /mit/<user> is a symlink to a |
---|
104 | # path within AFS. |
---|
105 | |
---|
106 | # Since this code is being invoked only at the beginning of |
---|
107 | # the session, and prior to the inclusion of any of the user's |
---|
108 | # other dotfiles, we can assume that the current directory is |
---|
109 | # the user's home directory. |
---|
110 | |
---|
111 | x=`/bin/pwd` |
---|
112 | if [ -n "$x" ]; then |
---|
113 | export HOME=$x |
---|
114 | fi |
---|
115 | unset x |
---|
116 | |
---|
117 | # Special version of ADD for the .bash_environment file. |
---|
118 | |
---|
119 | add () { |
---|
120 | eval "$( /bin/athena/attach -Padd -b -P"$athena_path" "$@" )" |
---|
121 | } |
---|
122 | |
---|
123 | # Run user environment customizations identified in your |
---|
124 | # ~/.bash_environment file. This is the place to include your |
---|
125 | # own environment variables, attach commands, and other system |
---|
126 | # wide setup commands. You can also cancel default behaviors |
---|
127 | # listed above. |
---|
128 | # ~/.bash_environment is not sourced if NOCALLS is set (i.e., |
---|
129 | # if you selected the xlogin "Ignore your customizations" |
---|
130 | # option when you logged in). |
---|
131 | |
---|
132 | if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then |
---|
133 | . ~/.bash_environment |
---|
134 | fi |
---|
135 | |
---|
136 | # On IRIX, limits are reset on exec of a setuid program, e.g. |
---|
137 | # xterm. So record now what the user wanted coredumpsize to |
---|
138 | # be so we can fix it later. |
---|
139 | export COREDUMPSIZE_LIMIT=`ulimit -c` |
---|
140 | |
---|
141 | # Standard Athena path |
---|
142 | athena_home_bin=$( /usr/athena/bin/athdir "$HOME" ) |
---|
143 | PATH=${athena_home_bin:+$athena_home_bin:}$athena_path:. |
---|
144 | unset athena_path athena_home_bin |
---|
145 | |
---|
146 | # Make sure applications can properly find their appdefs, etc. |
---|
147 | |
---|
148 | if [ "${XUSERFILESEARCHPATH+set}" != set ]; then |
---|
149 | XUSERFILESEARCHPATH=/usr/athena/lib/X11/app-defaults/%N |
---|
150 | else |
---|
151 | XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH:/usr/athena/lib/X11/app-defaults/%N |
---|
152 | fi |
---|
153 | |
---|
154 | if [ sgi = "$HOSTTYPE" -a "${skip_sgi+set}" != set -a "${NOCALLS+set}" != set ]; then |
---|
155 | XUSERFILESEARCHPATH="$HOME/.desktop-$host/%N:$HOME/.desktop-$host/0.0/%N:$XUSERFILESEARCHPATH" |
---|
156 | fi |
---|
157 | |
---|
158 | export XUSERFILESEARCHPATH |
---|
159 | |
---|
160 | |
---|
161 | if [ sun4 = "$HOSTTYPE" ]; then |
---|
162 | if [ "${XFILESEARCHPATH+set}" != set ]; then |
---|
163 | XFILESEARCHPATH="/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S" |
---|
164 | else |
---|
165 | XFILESEARCHPATH="$XFILESEARCHPATH:/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S" |
---|
166 | fi |
---|
167 | export XFILESEARCHPATH |
---|
168 | fi |
---|
169 | fi |
---|
170 | |
---|
171 | |
---|
172 | # ******************* BASH SETUP ******************* |
---|
173 | |
---|
174 | # Set up standard bash shell initializations |
---|
175 | |
---|
176 | set -o noclobber # Don't overwrite files with redirection |
---|
177 | |
---|
178 | if [ "${PS1+set}" = set ]; then |
---|
179 | if [ sgi = "$HOSTTYPE" -a -t 0 ]; then |
---|
180 | # Have no better way to do this at the moment. |
---|
181 | stty sane intr ^C |
---|
182 | fi |
---|
183 | case $HOME in |
---|
184 | /var/athena/tmphomedir/*) |
---|
185 | PS1="athena (temporary homedir)\$ " |
---|
186 | ;; |
---|
187 | *) |
---|
188 | PS1="athena\$ " |
---|
189 | ;; |
---|
190 | esac |
---|
191 | HISTSIZE=20 |
---|
192 | CDPATH=.:~ |
---|
193 | fi |
---|
194 | |
---|
195 | # Fix coredumpsize limit in case it was reset |
---|
196 | [ -n "$COREDUMPSIZE_LIMIT" ] && ulimit -c $COREDUMPSIZE_LIMIT |
---|
197 | |
---|
198 | # alias for re-establishing authentication |
---|
199 | renew () { kinit $USER && fsid -a && zctl load /dev/null ; } |
---|
200 | |
---|
201 | # alias for a convenient way to change terminal type |
---|
202 | term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; } |
---|
203 | |
---|
204 | # aliases dealing with x window system |
---|
205 | xresize () { set -f; eval "$( resize -u )"; set +f ; } |
---|
206 | |
---|
207 | if [ "${XSESSION+set}" = set ]; then |
---|
208 | if [ -z "$XSESSION" ]; then |
---|
209 | logout () { end_session && exit; } # logout for X |
---|
210 | else |
---|
211 | logout () { kill -HUP $XSESSION && exit; } # logout for X |
---|
212 | fi |
---|
213 | fi |
---|
214 | |
---|
215 | # aliases dealing with adding locker programs |
---|
216 | |
---|
217 | add_flags= |
---|
218 | add () { eval "$( /bin/athena/attach -Padd -b $add_flags "$@" )" ; } |
---|
219 | |
---|
220 | alias setup='echo "setup is not supported in bash yet"' |
---|
221 | |
---|
222 | |
---|
223 | # All of the bash initializing commands above can be overridden by using |
---|
224 | # "unset" or "unalias" commands (or by changing things using "set" or |
---|
225 | # "alias" again) in your ~/.bashrc.mine file, which is sourced here. |
---|
226 | # ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations" |
---|
227 | # option was selected to begin the session. |
---|
228 | |
---|
229 | if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then |
---|
230 | . ~/.bashrc.mine |
---|
231 | fi |
---|