1 | # Global bashrc file |
---|
2 | # |
---|
3 | # $Id: bashrc,v 1.30 2003-07-30 18:31:50 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/dt/bin:/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/openwin/lib |
---|
82 | export OPENWINHOME=/usr/openwin |
---|
83 | ;; |
---|
84 | linux) |
---|
85 | # This is to ensure that native programs use the Athena |
---|
86 | # gconf, ORBit, bonobo-activation, etc. libraries |
---|
87 | # rather than the native ones. GNOME programs outside |
---|
88 | # of /usr/athena/bin may not function properly if it is |
---|
89 | # not set. |
---|
90 | export LD_LIBRARY_PATH=/usr/athena/lib |
---|
91 | ;; |
---|
92 | esac |
---|
93 | |
---|
94 | export ATHENA_SYS=`/bin/athena/machtype -S` |
---|
95 | export ATHENA_SYS_COMPAT=`/bin/athena/machtype -C` |
---|
96 | |
---|
97 | if [ -z "$ATHENA_SYS" ]; then |
---|
98 | export ATHENA_SYS=@sys |
---|
99 | fi |
---|
100 | |
---|
101 | if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then |
---|
102 | PRINTER=`awk '/LPR/ { print $3 }' /var/athena/clusterinfo` |
---|
103 | if [ -n "$PRINTER" ]; then export PRINTER; fi |
---|
104 | fi |
---|
105 | |
---|
106 | # Reset the HOME variable to correspond to the actual location |
---|
107 | # of the user's home directory. This will avoid having long |
---|
108 | # pathnames being printed when /mit/<user> is a symlink to a |
---|
109 | # path within AFS. |
---|
110 | |
---|
111 | # Since this code is being invoked only at the beginning of |
---|
112 | # the session, and prior to the inclusion of any of the user's |
---|
113 | # other dotfiles, we can assume that the current directory is |
---|
114 | # the user's home directory. |
---|
115 | |
---|
116 | x=`/bin/pwd` |
---|
117 | if [ -n "$x" ]; then |
---|
118 | export HOME=$x |
---|
119 | fi |
---|
120 | unset x |
---|
121 | |
---|
122 | # Special version of ADD for the .bash_environment file. |
---|
123 | |
---|
124 | add () { |
---|
125 | eval "$( /bin/athena/attach -Padd -b -P"$athena_path" "$@" )" |
---|
126 | } |
---|
127 | |
---|
128 | # Run user environment customizations identified in your |
---|
129 | # ~/.bash_environment file. This is the place to include your |
---|
130 | # own environment variables, attach commands, and other system |
---|
131 | # wide setup commands. You can also cancel default behaviors |
---|
132 | # listed above. |
---|
133 | # ~/.bash_environment is not sourced if NOCALLS is set (i.e., |
---|
134 | # if you selected the xlogin "Ignore your customizations" |
---|
135 | # option when you logged in). |
---|
136 | |
---|
137 | if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then |
---|
138 | . ~/.bash_environment |
---|
139 | fi |
---|
140 | |
---|
141 | # On IRIX, limits are reset on exec of a setuid program, e.g. |
---|
142 | # xterm. So record now what the user wanted coredumpsize to |
---|
143 | # be so we can fix it later. |
---|
144 | export COREDUMPSIZE_LIMIT=`ulimit -c` |
---|
145 | |
---|
146 | # Standard Athena path |
---|
147 | athena_home_bin=$( /usr/athena/bin/athdir "$HOME" ) |
---|
148 | PATH=${athena_home_bin:+$athena_home_bin:}$athena_path:. |
---|
149 | unset athena_path athena_home_bin |
---|
150 | |
---|
151 | # Make sure applications can properly find their appdefs, etc. |
---|
152 | |
---|
153 | if [ "${XUSERFILESEARCHPATH+set}" != set ]; then |
---|
154 | XUSERFILESEARCHPATH=/usr/athena/lib/X11/app-defaults/%N |
---|
155 | else |
---|
156 | XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH:/usr/athena/lib/X11/app-defaults/%N |
---|
157 | fi |
---|
158 | |
---|
159 | if [ sgi = "$HOSTTYPE" -a "${skip_sgi+set}" != set -a "${NOCALLS+set}" != set ]; then |
---|
160 | XUSERFILESEARCHPATH="$HOME/.desktop-$host/%N:$HOME/.desktop-$host/0.0/%N:$XUSERFILESEARCHPATH" |
---|
161 | fi |
---|
162 | |
---|
163 | export XUSERFILESEARCHPATH |
---|
164 | |
---|
165 | |
---|
166 | if [ sun4 = "$HOSTTYPE" ]; then |
---|
167 | if [ "${XFILESEARCHPATH+set}" != set ]; then |
---|
168 | XFILESEARCHPATH="/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S" |
---|
169 | else |
---|
170 | XFILESEARCHPATH="$XFILESEARCHPATH:/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S" |
---|
171 | fi |
---|
172 | export XFILESEARCHPATH |
---|
173 | fi |
---|
174 | fi |
---|
175 | |
---|
176 | |
---|
177 | # ******************* BASH SETUP ******************* |
---|
178 | |
---|
179 | # Set up standard bash shell initializations |
---|
180 | |
---|
181 | set -o noclobber # Don't overwrite files with redirection |
---|
182 | |
---|
183 | if [ "${PS1+set}" = set ]; then |
---|
184 | if [ sgi = "$HOSTTYPE" -a -t 0 ]; then |
---|
185 | # Have no better way to do this at the moment. |
---|
186 | stty sane intr ^C |
---|
187 | fi |
---|
188 | case $HOME in |
---|
189 | /var/athena/tmphomedir/*) |
---|
190 | PS1="athena (temporary homedir)\$ " |
---|
191 | ;; |
---|
192 | *) |
---|
193 | PS1="athena\$ " |
---|
194 | ;; |
---|
195 | esac |
---|
196 | HISTSIZE=20 |
---|
197 | CDPATH=.:~ |
---|
198 | fi |
---|
199 | |
---|
200 | # Fix coredumpsize limit in case it was reset |
---|
201 | [ -n "$COREDUMPSIZE_LIMIT" ] && ulimit -c $COREDUMPSIZE_LIMIT |
---|
202 | |
---|
203 | # alias for re-establishing authentication |
---|
204 | renew () { kinit $USER && fsid -a && zctl load /dev/null ; } |
---|
205 | |
---|
206 | # alias for a convenient way to change terminal type |
---|
207 | term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; } |
---|
208 | |
---|
209 | # aliases dealing with x window system |
---|
210 | xresize () { set -f; eval "$( resize -u )"; set +f ; } |
---|
211 | |
---|
212 | if [ "${XSESSION+set}" = set ]; then |
---|
213 | if [ -z "$XSESSION" ]; then |
---|
214 | logout () { end_session && exit; } # logout for X |
---|
215 | else |
---|
216 | logout () { kill -HUP $XSESSION && exit; } # logout for X |
---|
217 | fi |
---|
218 | fi |
---|
219 | |
---|
220 | # aliases dealing with adding locker programs |
---|
221 | |
---|
222 | add_flags= |
---|
223 | add () { eval "$( /bin/athena/attach -Padd -b $add_flags "$@" )" ; } |
---|
224 | |
---|
225 | alias setup='echo "setup is not supported in bash yet"' |
---|
226 | |
---|
227 | |
---|
228 | # All of the bash initializing commands above can be overridden by using |
---|
229 | # "unset" or "unalias" commands (or by changing things using "set" or |
---|
230 | # "alias" again) in your ~/.bashrc.mine file, which is sourced here. |
---|
231 | # ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations" |
---|
232 | # option was selected to begin the session. |
---|
233 | |
---|
234 | if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then |
---|
235 | . ~/.bashrc.mine |
---|
236 | fi |
---|