[13196] | 1 | # Global bashrc file |
---|
| 2 | # |
---|
[22516] | 3 | # $Id: bashrc,v 1.39 2006-07-17 23:14:07 rbasch Exp $ |
---|
[13196] | 4 | |
---|
| 5 | # This file is sourced by default user file ~/.bashrc |
---|
| 6 | |
---|
[22913] | 7 | initdir=/usr/lib/init |
---|
[13196] | 8 | |
---|
[22913] | 9 | # add alias moved here to avoid having two copies of it. |
---|
[13196] | 10 | |
---|
[22913] | 11 | add () { eval "$( /bin/attach -Padd -b "$@" )" ; } |
---|
[13196] | 12 | |
---|
[22913] | 13 | |
---|
[13196] | 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 | |
---|
[21129] | 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 |
---|
[22940] | 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. |
---|
[21129] | 30 | if [ "${ENV_SET:+set}" != set -a "${SHELL##*/}" = bash ]; then |
---|
[13196] | 31 | |
---|
| 32 | export ENV_SET=t # Avoid unnecessary repeat |
---|
[22913] | 33 | export HOSTTYPE="`/bin/machtype`" |
---|
[13196] | 34 | |
---|
[22975] | 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 | |
---|
[13196] | 41 | umask 077 # Strictly protect files |
---|
| 42 | # (does not apply in AFS) |
---|
[21164] | 43 | ulimit -S -c 0 # Don't allow coredumps |
---|
[13196] | 44 | export EDITOR=emacs # Set default editor |
---|
| 45 | export VISUAL=emacs # Set default screen editor |
---|
| 46 | export MM_CHARSET=iso-8859-1 |
---|
| 47 | |
---|
[22913] | 48 | export MORE=-s |
---|
[13222] | 49 | |
---|
[22975] | 50 | # Set double-sided printing for sufficiently recent users. |
---|
| 51 | if [ 1 -le "$ATHENA_DOTFILE_GENERATION" ]; then |
---|
| 52 | export LPROPT=-Zduplex |
---|
| 53 | fi |
---|
| 54 | |
---|
[22913] | 55 | export ATHENA_SYS=`/bin/machtype -S` |
---|
| 56 | export ATHENA_SYS_COMPAT=`/bin/machtype -C` |
---|
[13196] | 57 | |
---|
[13238] | 58 | if [ -z "$ATHENA_SYS" ]; then |
---|
[13196] | 59 | export ATHENA_SYS=@sys |
---|
[13238] | 60 | fi |
---|
[13196] | 61 | |
---|
[13222] | 62 | if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then |
---|
[13196] | 63 | PRINTER=`awk '/LPR/ { print $3 }' /var/athena/clusterinfo` |
---|
| 64 | if [ -n "$PRINTER" ]; then export PRINTER; fi |
---|
| 65 | fi |
---|
| 66 | |
---|
| 67 | # Reset the HOME variable to correspond to the actual location |
---|
| 68 | # of the user's home directory. This will avoid having long |
---|
| 69 | # pathnames being printed when /mit/<user> is a symlink to a |
---|
| 70 | # path within AFS. |
---|
[13222] | 71 | |
---|
[22439] | 72 | x=`(cd && /bin/pwd) 2>/dev/null` |
---|
[13196] | 73 | if [ -n "$x" ]; then |
---|
| 74 | export HOME=$x |
---|
[22439] | 75 | if [ "$x" = "`/bin/pwd`" ]; then |
---|
| 76 | cd "$HOME" |
---|
| 77 | fi |
---|
[13196] | 78 | fi |
---|
| 79 | unset x |
---|
| 80 | |
---|
| 81 | # Run user environment customizations identified in your |
---|
| 82 | # ~/.bash_environment file. This is the place to include your |
---|
| 83 | # own environment variables, attach commands, and other system |
---|
| 84 | # wide setup commands. You can also cancel default behaviors |
---|
[13242] | 85 | # listed above. |
---|
[13196] | 86 | # ~/.bash_environment is not sourced if NOCALLS is set (i.e., |
---|
| 87 | # if you selected the xlogin "Ignore your customizations" |
---|
| 88 | # option when you logged in). |
---|
| 89 | |
---|
[13222] | 90 | if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then |
---|
[13196] | 91 | . ~/.bash_environment |
---|
| 92 | fi |
---|
[13564] | 93 | |
---|
[23030] | 94 | # If the user has a bindir in $HOME, put it in front of the path. |
---|
[22913] | 95 | athena_home_bin=$( /usr/bin/athdir "$HOME" ) |
---|
[23030] | 96 | PATH=${athena_home_bin:+$athena_home_bin:}$PATH |
---|
[22913] | 97 | unset athena_home_bin |
---|
[13196] | 98 | |
---|
| 99 | fi |
---|
| 100 | |
---|
[22913] | 101 | |
---|
[13196] | 102 | # ******************* BASH SETUP ******************* |
---|
| 103 | |
---|
| 104 | # Set up standard bash shell initializations |
---|
| 105 | |
---|
| 106 | # alias for re-establishing authentication |
---|
[22913] | 107 | renew () { kinit -54 $USER && fsid -a && zctl load /dev/null ; } |
---|
[13196] | 108 | |
---|
| 109 | # alias for a convenient way to change terminal type |
---|
[13276] | 110 | term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; } |
---|
[13196] | 111 | |
---|
| 112 | # aliases dealing with x window system |
---|
[13276] | 113 | xresize () { set -f; eval "$( resize -u )"; set +f ; } |
---|
[13196] | 114 | |
---|
[13479] | 115 | if [ "${XSESSION+set}" = set ]; then |
---|
[13196] | 116 | if [ -z "$XSESSION" ]; then |
---|
[13238] | 117 | logout () { end_session && exit; } # logout for X |
---|
[13196] | 118 | else |
---|
[13238] | 119 | logout () { kill -HUP $XSESSION && exit; } # logout for X |
---|
[13196] | 120 | fi |
---|
| 121 | fi |
---|
| 122 | |
---|
| 123 | # aliases dealing with adding locker programs |
---|
| 124 | |
---|
[13238] | 125 | alias setup='echo "setup is not supported in bash yet"' |
---|
[13196] | 126 | |
---|
| 127 | |
---|
[13222] | 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 |
---|
[13196] | 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 | |
---|
[13222] | 134 | if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then |
---|
[13196] | 135 | . ~/.bashrc.mine |
---|
| 136 | fi |
---|