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