[13196] | 1 | # Global bashrc file |
---|
| 2 | # |
---|
[19148] | 3 | # $Id: bashrc,v 1.28 2003-04-02 15:36:52 ghudson Exp $ |
---|
[13196] | 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 | |
---|
[15174] | 18 | if [ "${ENV_SET:+set}" != set ]; then |
---|
[13196] | 19 | |
---|
| 20 | export ENV_SET=t # Avoid unnecessary repeat |
---|
[13222] | 21 | export HOSTTYPE="`/bin/athena/machtype`" |
---|
[13196] | 22 | |
---|
| 23 | umask 077 # Strictly protect files |
---|
| 24 | # (does not apply in AFS) |
---|
[16269] | 25 | ulimit -c unlimited # Don't allow coredumps |
---|
[13196] | 26 | export EDITOR=emacs # Set default editor |
---|
| 27 | export VISUAL=emacs # Set default screen editor |
---|
| 28 | export MM_CHARSET=iso-8859-1 |
---|
| 29 | |
---|
[13222] | 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) |
---|
[16552] | 34 | athena_path=/usr/athena/bin:/usr/athena/etc: |
---|
[16377] | 35 | athena_path=$athena_path:/bin/athena:/usr/sbin:/usr/bsd:/sbin |
---|
[17157] | 36 | athena_path=$athena_path:/usr/bin:/bin:/usr/bin/X11:/usr/etc |
---|
[13222] | 37 | MANPATH=/usr/athena/man:/usr/freeware/catman:/usr/share/catman |
---|
| 38 | MANPATH=$MANPATH:/usr/share/man:/usr/catman:/usr/man |
---|
| 39 | ;; |
---|
| 40 | sun4) |
---|
[16377] | 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 |
---|
[17157] | 44 | athena_path=$athena_path:/usr/ccs/bin:/usr/sbin:/sbin:/usr/ucb |
---|
[13222] | 45 | MANPATH=/usr/athena/man:/usr/openwin/man:/usr/dt/man:/usr/man |
---|
| 46 | ;; |
---|
| 47 | linux) |
---|
[16377] | 48 | athena_path=/srvd/patch:/usr/athena/bin:/usr/athena/etc |
---|
| 49 | athena_path=$athena_path:/bin/athena:/usr/bin:/bin |
---|
[17157] | 50 | athena_path=$athena_path:/usr/X11R6/bin:/usr/athena/etc |
---|
| 51 | athena_path=$athena_path:/usr/sbin:/sbin |
---|
[16137] | 52 | MANPATH=/usr/athena/man:/usr/share/man:/usr/X11R6/man |
---|
[13222] | 53 | ;; |
---|
| 54 | *) |
---|
| 55 | echo "Standard dotfiles do not support system type $HOSTTYPE." |
---|
| 56 | esac |
---|
| 57 | export MANPATH |
---|
| 58 | |
---|
[13196] | 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 | |
---|
[13266] | 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) |
---|
[19148] | 81 | export LD_LIBRARY_PATH=/usr/athena/lib:/usr/openwin/lib |
---|
[13196] | 82 | export OPENWINHOME=/usr/openwin |
---|
[13266] | 83 | ;; |
---|
[19148] | 84 | linux) |
---|
| 85 | export LD_LIBRARY_PATH=/usr/athena/lib |
---|
| 86 | ;; |
---|
[13266] | 87 | esac |
---|
[13196] | 88 | |
---|
| 89 | export ATHENA_SYS=`/bin/athena/machtype -S` |
---|
| 90 | export ATHENA_SYS_COMPAT=`/bin/athena/machtype -C` |
---|
| 91 | |
---|
[13238] | 92 | if [ -z "$ATHENA_SYS" ]; then |
---|
[13196] | 93 | export ATHENA_SYS=@sys |
---|
[13238] | 94 | fi |
---|
[13196] | 95 | |
---|
[13222] | 96 | if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then |
---|
[13196] | 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. |
---|
[13222] | 105 | |
---|
[13236] | 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 |
---|
[13196] | 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 () { |
---|
[13475] | 120 | eval "$( /bin/athena/attach -Padd -b -P"$athena_path" "$@" )" |
---|
[13196] | 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 |
---|
[13242] | 127 | # listed above. |
---|
[13196] | 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 | |
---|
[13222] | 132 | if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then |
---|
[13196] | 133 | . ~/.bash_environment |
---|
| 134 | fi |
---|
| 135 | |
---|
[13564] | 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 | |
---|
[13196] | 141 | # Standard Athena path |
---|
[18771] | 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 |
---|
[13196] | 145 | |
---|
| 146 | # Make sure applications can properly find their appdefs, etc. |
---|
| 147 | |
---|
[13222] | 148 | if [ "${XUSERFILESEARCHPATH+set}" != set ]; then |
---|
[13196] | 149 | XUSERFILESEARCHPATH=/usr/athena/lib/X11/app-defaults/%N |
---|
| 150 | else |
---|
[13222] | 151 | XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH:/usr/athena/lib/X11/app-defaults/%N |
---|
[13238] | 152 | fi |
---|
[13196] | 153 | |
---|
[13238] | 154 | if [ sgi = "$HOSTTYPE" -a "${skip_sgi+set}" != set -a "${NOCALLS+set}" != set ]; then |
---|
[13196] | 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 |
---|
[13238] | 162 | if [ "${XFILESEARCHPATH+set}" != set ]; then |
---|
[13222] | 163 | XFILESEARCHPATH="/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S" |
---|
[13196] | 164 | else |
---|
[13222] | 165 | XFILESEARCHPATH="$XFILESEARCHPATH:/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S" |
---|
[13196] | 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 | |
---|
[13222] | 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 |
---|
[16312] | 183 | case $HOME in |
---|
| 184 | /var/athena/tmphomedir/*) |
---|
[16335] | 185 | PS1="athena (temporary homedir)\$ " |
---|
[16312] | 186 | ;; |
---|
| 187 | *) |
---|
[16335] | 188 | PS1="athena\$ " |
---|
[16312] | 189 | ;; |
---|
| 190 | esac |
---|
[13222] | 191 | HISTSIZE=20 |
---|
[15035] | 192 | CDPATH=.:~ |
---|
[13222] | 193 | fi |
---|
[13196] | 194 | |
---|
[13564] | 195 | # Fix coredumpsize limit in case it was reset |
---|
[15874] | 196 | [ -n "$COREDUMPSIZE_LIMIT" ] && ulimit -c $COREDUMPSIZE_LIMIT |
---|
[13564] | 197 | |
---|
[13196] | 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 |
---|
[13276] | 202 | term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; } |
---|
[13196] | 203 | |
---|
| 204 | # aliases dealing with x window system |
---|
[13276] | 205 | xresize () { set -f; eval "$( resize -u )"; set +f ; } |
---|
[13196] | 206 | |
---|
[13479] | 207 | if [ "${XSESSION+set}" = set ]; then |
---|
[13196] | 208 | if [ -z "$XSESSION" ]; then |
---|
[13238] | 209 | logout () { end_session && exit; } # logout for X |
---|
[13196] | 210 | else |
---|
[13238] | 211 | logout () { kill -HUP $XSESSION && exit; } # logout for X |
---|
[13196] | 212 | fi |
---|
| 213 | fi |
---|
| 214 | |
---|
| 215 | # aliases dealing with adding locker programs |
---|
| 216 | |
---|
| 217 | add_flags= |
---|
[13276] | 218 | add () { eval "$( /bin/athena/attach -Padd -b $add_flags "$@" )" ; } |
---|
[13196] | 219 | |
---|
[13238] | 220 | alias setup='echo "setup is not supported in bash yet"' |
---|
[13196] | 221 | |
---|
| 222 | |
---|
[13222] | 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 |
---|
[13196] | 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 | |
---|
[13222] | 229 | if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then |
---|
[13196] | 230 | . ~/.bashrc.mine |
---|
| 231 | fi |
---|