[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 | |
---|
| 9 | # ******************* ENVIRONMENT SETUP ******************* |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | # Set up standard system/user environment configuration (including setup of |
---|
| 14 | # environment variables, attachment of lockers, and setting of search path) |
---|
| 15 | |
---|
[21129] | 16 | # If we see ENV_SET set to empty, we could be a tcsh user who has |
---|
| 17 | # decided to run bash, or we could be a bash user suffering from the |
---|
| 18 | # misfeature that the standard xsession script runs the tcsh dotfiles |
---|
| 19 | # for all users. Running the environment setup for the former |
---|
| 20 | # category of user would be unfriendly (it resets the homedir and |
---|
[22940] | 21 | # changes the path), so for now, only run environment setup for bash |
---|
| 22 | # users. If the xsession problem is ever fixed, change this |
---|
| 23 | # conditional to check for '"${ENV_SET+set}" != set' and eliminate the |
---|
| 24 | # shell check. |
---|
[21129] | 25 | if [ "${ENV_SET:+set}" != set -a "${SHELL##*/}" = bash ]; then |
---|
[13196] | 26 | |
---|
| 27 | export ENV_SET=t # Avoid unnecessary repeat |
---|
[22913] | 28 | export HOSTTYPE="`/bin/machtype`" |
---|
[13196] | 29 | |
---|
[22975] | 30 | if [ -r "$HOME/.generation" ]; then |
---|
| 31 | export ATHENA_DOTFILE_GENERATION=`cat "$HOME/.generation"` |
---|
| 32 | else |
---|
| 33 | export ATHENA_DOTFILE_GENERATION=0 |
---|
| 34 | fi |
---|
| 35 | |
---|
[21164] | 36 | ulimit -S -c 0 # Don't allow coredumps |
---|
[13196] | 37 | export EDITOR=emacs # Set default editor |
---|
| 38 | export MM_CHARSET=iso-8859-1 |
---|
| 39 | |
---|
[23438] | 40 | export EMAIL="$USER@mit.edu" # Set default email address |
---|
| 41 | |
---|
[22913] | 42 | export MORE=-s |
---|
[13222] | 43 | |
---|
[22975] | 44 | # Set double-sided printing for sufficiently recent users. |
---|
| 45 | if [ 1 -le "$ATHENA_DOTFILE_GENERATION" ]; then |
---|
| 46 | export LPROPT=-Zduplex |
---|
| 47 | fi |
---|
| 48 | |
---|
[22913] | 49 | export ATHENA_SYS=`/bin/machtype -S` |
---|
| 50 | export ATHENA_SYS_COMPAT=`/bin/machtype -C` |
---|
[13196] | 51 | |
---|
[13238] | 52 | if [ -z "$ATHENA_SYS" ]; then |
---|
[13196] | 53 | export ATHENA_SYS=@sys |
---|
[13238] | 54 | fi |
---|
[13196] | 55 | |
---|
[23132] | 56 | if [ "${PRINTER+set}" != set \ |
---|
[23513] | 57 | -a -e /var/run/athena-clusterinfo.csh ]; then |
---|
[23132] | 58 | PRINTER=`awk '/LPR/ { print $3 }' \ |
---|
[23513] | 59 | /var/run/athena-clusterinfo.csh` |
---|
[13196] | 60 | if [ -n "$PRINTER" ]; then export PRINTER; fi |
---|
| 61 | fi |
---|
| 62 | |
---|
| 63 | # Reset the HOME variable to correspond to the actual location |
---|
| 64 | # of the user's home directory. This will avoid having long |
---|
| 65 | # pathnames being printed when /mit/<user> is a symlink to a |
---|
| 66 | # path within AFS. |
---|
[13222] | 67 | |
---|
[22439] | 68 | x=`(cd && /bin/pwd) 2>/dev/null` |
---|
[13196] | 69 | if [ -n "$x" ]; then |
---|
| 70 | export HOME=$x |
---|
[22439] | 71 | if [ "$x" = "`/bin/pwd`" ]; then |
---|
| 72 | cd "$HOME" |
---|
| 73 | fi |
---|
[13196] | 74 | fi |
---|
| 75 | unset x |
---|
| 76 | |
---|
| 77 | # Run user environment customizations identified in your |
---|
| 78 | # ~/.bash_environment file. This is the place to include your |
---|
| 79 | # own environment variables, attach commands, and other system |
---|
| 80 | # wide setup commands. You can also cancel default behaviors |
---|
[13242] | 81 | # listed above. |
---|
[13196] | 82 | # ~/.bash_environment is not sourced if NOCALLS is set (i.e., |
---|
| 83 | # if you selected the xlogin "Ignore your customizations" |
---|
| 84 | # option when you logged in). |
---|
| 85 | |
---|
[13222] | 86 | if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then |
---|
[13196] | 87 | . ~/.bash_environment |
---|
| 88 | fi |
---|
[13564] | 89 | |
---|
[23030] | 90 | # If the user has a bindir in $HOME, put it in front of the path. |
---|
[22913] | 91 | athena_home_bin=$( /usr/bin/athdir "$HOME" ) |
---|
[23030] | 92 | PATH=${athena_home_bin:+$athena_home_bin:}$PATH |
---|
[22913] | 93 | unset athena_home_bin |
---|
[13196] | 94 | |
---|
| 95 | fi |
---|
| 96 | |
---|
[22913] | 97 | |
---|
[13196] | 98 | # ******************* BASH SETUP ******************* |
---|
| 99 | |
---|
| 100 | # Set up standard bash shell initializations |
---|
| 101 | |
---|
[13479] | 102 | if [ "${XSESSION+set}" = set ]; then |
---|
[23182] | 103 | logout () { gnome-session-save --kill --silent; exit; } # logout for X |
---|
[13196] | 104 | fi |
---|
| 105 | |
---|
| 106 | # aliases dealing with adding locker programs |
---|
| 107 | |
---|
[23782] | 108 | setup_tty () {(export SUBJECT="$@"; $SHELL)} |
---|
| 109 | setup_X () {(export SUBJECT="$@"; xterm -title "$@" &)} |
---|
[13196] | 110 | |
---|
[23782] | 111 | if [ -n "$XSESSION" ]; then |
---|
| 112 | alias setup=setup_X |
---|
| 113 | else |
---|
| 114 | alias setup=setup_tty |
---|
| 115 | fi |
---|
[13196] | 116 | |
---|
[23782] | 117 | remove () { export SUBJECT="$@"; |
---|
| 118 | source $initdir/env_remove.bash; |
---|
| 119 | unset SUBJECT; } |
---|
| 120 | |
---|
| 121 | if [ -n "$SUBJECT" -a -r $initdir/env_setup.bash ]; then |
---|
| 122 | source $initdir/env_setup.bash |
---|
| 123 | fi |
---|
| 124 | |
---|
| 125 | |
---|
[13222] | 126 | # All of the bash initializing commands above can be overridden by using |
---|
| 127 | # "unset" or "unalias" commands (or by changing things using "set" or |
---|
[13196] | 128 | # "alias" again) in your ~/.bashrc.mine file, which is sourced here. |
---|
| 129 | # ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations" |
---|
| 130 | # option was selected to begin the session. |
---|
| 131 | |
---|
[13222] | 132 | if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then |
---|
[13196] | 133 | . ~/.bashrc.mine |
---|
| 134 | fi |
---|