source: trunk/packs/dotfiles/bashrc @ 21166

Revision 21166, 7.1 KB checked in by rbasch, 20 years ago (diff)
Remove the setting of HISTSIZE to 20; the default history size of 500 is more reasonable.
Line 
1# Global bashrc file
2#
3# $Id: bashrc,v 1.35 2004-11-10 15:37:17 rbasch Exp $
4
5# This file is sourced by default user file ~/.bashrc
6
7initdir=/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 we see ENV_SET set to empty, we could be a tcsh user who has
19# decided to run bash, or we could be a bash user suffering from the
20# misfeature that the standard xsession script runs the tcsh dotfiles
21# for all users.  Running the environment setup for the former
22# category of user would be unfriendly (it resets the homedir and
23# path), so for now, only run environment setup for bash users.  If
24# the xsession problem is ever fixed, change this conditional to check
25# for '"${ENV_SET+set}" != set' and eliminate the shell check.
26if [ "${ENV_SET:+set}" != set -a "${SHELL##*/}" = bash ]; then
27
28        export ENV_SET=t                        # Avoid unnecessary repeat
29        export HOSTTYPE="`/bin/athena/machtype`"
30
31        umask 077                               # Strictly protect files
32                                                #  (does not apply in AFS)
33        ulimit -S -c 0                          # Don't allow coredumps
34        export EDITOR=emacs                     # Set default editor
35        export VISUAL=emacs                     # Set default screen editor
36        export MM_CHARSET=iso-8859-1
37
38        # Set standard Athena path variables (generic path for all users).
39        # PATH will get set later after .bash_environment is run.
40        case "$HOSTTYPE" in
41        sgi)
42                athena_path=/usr/athena/bin:/usr/athena/etc:
43                athena_path=$athena_path:/bin/athena:/usr/sbin:/usr/bsd:/sbin
44                athena_path=$athena_path:/usr/bin:/bin:/usr/bin/X11:/usr/etc
45                MANPATH=/usr/athena/man:/usr/freeware/catman:/usr/share/catman
46                MANPATH=$MANPATH:/usr/share/man:/usr/catman:/usr/man
47                ;;
48        sun4)
49                athena_path=/srvd/patch:/usr/athena/bin:/usr/athena/etc
50                athena_path=$athena_path:/bin/athena:/usr/openwin/bin
51                athena_path=$athena_path:/usr/openwin/demo:/usr/dt/bin:/usr/bin
52                athena_path=$athena_path:/usr/ccs/bin:/usr/sbin:/sbin
53                athena_path=$athena_path:/usr/sfw/bin:/usr/ucb
54                MANPATH=/usr/athena/man:/usr/openwin/man:/usr/dt/man:/usr/man
55                MANPATH=$MANPATH:/usr/sfw/man
56                ;;
57        linux)
58                athena_path=/srvd/patch:/usr/athena/bin:/usr/athena/etc
59                athena_path=$athena_path:/bin/athena:/usr/bin:/bin
60                athena_path=$athena_path:/usr/X11R6/bin:/usr/athena/etc
61                athena_path=$athena_path:/usr/sbin:/sbin
62                MANPATH=/usr/athena/man:/usr/share/man:/usr/X11R6/man
63                ;;
64        *)
65                echo "Standard dotfiles do not support system type $HOSTTYPE."
66        esac
67        export MANPATH
68
69        # Default "more" behavior
70        case $HOSTTYPE in
71        sgi)
72                MORE=-se
73                ;;
74        *)
75                MORE=-s
76                ;;
77        esac
78        export MORE
79
80        # Set miscellaneous system-dependent variables.
81        case $HOSTTYPE in
82        sgi)
83                # The following set the default error message format
84                # to omit the label and severity components, per the
85                # standard IRIX /etc/profile.
86                export MSGVERB=text:action
87                export NOMSGLABEL=1
88                export NOMSGSEVERITY=1
89                ;;
90        sun4)
91                export OPENWINHOME=/usr/openwin
92                ;;
93        linux)
94                # This is to ensure that native programs use the Athena
95                # gconf, ORBit, bonobo-activation, etc. libraries
96                # rather than the native ones.  GNOME programs outside
97                # of /usr/athena/bin may not function properly if it is
98                # not set.
99                export LD_LIBRARY_PATH=/usr/athena/lib
100                ;;
101        esac
102       
103        export ATHENA_SYS=`/bin/athena/machtype -S`
104        export ATHENA_SYS_COMPAT=`/bin/athena/machtype -C`
105
106        if [ -z "$ATHENA_SYS" ]; then
107                export ATHENA_SYS=@sys
108        fi
109
110        if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then
111                PRINTER=`awk '/LPR/ { print $3 }' /var/athena/clusterinfo`
112                if [ -n "$PRINTER" ]; then export PRINTER; fi
113        fi
114
115        # Reset the HOME variable to correspond to the actual location
116        # of the user's home directory.  This will avoid having long
117        # pathnames being printed when /mit/<user> is a symlink to a
118        # path within AFS.
119
120        # Since this code is being invoked only at the beginning of
121        # the session, and prior to the inclusion of any of the user's
122        # other dotfiles, we can assume that the current directory is
123        # the user's home directory.
124
125        x=`/bin/pwd`
126        if [ -n "$x" ]; then
127                export HOME=$x
128        fi
129        unset x
130
131        # Special version of ADD for the .bash_environment file.
132
133        add () {
134                eval "$( /bin/athena/attach -Padd -b -P"$athena_path" "$@" )"
135        }
136
137        # Run user environment customizations identified in your
138        # ~/.bash_environment file.  This is the place to include your
139        # own environment variables, attach commands, and other system
140        # wide setup commands.  You can also cancel default behaviors
141        # listed above.
142        # ~/.bash_environment is not sourced if NOCALLS is set (i.e.,
143        # if you selected the xlogin "Ignore your customizations"
144        # option when you logged in).
145
146        if [ "${NOCALLS+set}" != set -a -r ~/.bash_environment ]; then
147                . ~/.bash_environment
148        fi
149       
150        # On IRIX, limits are reset on exec of a setuid program, e.g.
151        # xterm. So record now what the user wanted coredumpsize to
152        # be so we can fix it later.
153        export COREDUMPSIZE_LIMIT=`ulimit -c`
154
155        # Standard Athena path
156        athena_home_bin=$( /usr/athena/bin/athdir "$HOME" )
157        PATH=${athena_home_bin:+$athena_home_bin:}$athena_path:.
158        unset athena_path athena_home_bin
159
160        # Make sure applications can properly find their appdefs, etc.
161
162        if [ "${XUSERFILESEARCHPATH+set}" != set ]; then
163                XUSERFILESEARCHPATH=/usr/athena/lib/X11/app-defaults/%N
164        else
165                XUSERFILESEARCHPATH=$XUSERFILESEARCHPATH:/usr/athena/lib/X11/app-defaults/%N
166        fi
167
168        if [ sgi = "$HOSTTYPE" -a "${skip_sgi+set}" != set -a "${NOCALLS+set}" != set ]; then
169                XUSERFILESEARCHPATH="$HOME/.desktop-$host/%N:$HOME/.desktop-$host/0.0/%N:$XUSERFILESEARCHPATH"
170        fi
171
172        export XUSERFILESEARCHPATH
173
174fi
175       
176
177# *******************  BASH SETUP   *******************
178
179# Set up standard bash shell initializations
180
181set -o noclobber                # Don't overwrite files with redirection
182
183if [ "${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        CDPATH=.:~
197fi
198
199# Fix coredumpsize limit in case it was reset
200[ -n "$COREDUMPSIZE_LIMIT" ] && ulimit -S -c $COREDUMPSIZE_LIMIT
201
202#   alias for re-establishing authentication
203renew () { kinit $USER && fsid -a && zctl load /dev/null ; }
204
205#   alias for a convenient way to change terminal type
206term () { set -f; unset TERMCAP; eval "$( tset -s -I -Q "$@" )"; set +f; }
207
208#   aliases dealing with x window system
209xresize () { set -f; eval "$( resize -u )"; set +f ; }
210
211if [ "${XSESSION+set}" = set ]; then
212        if [ -z "$XSESSION" ]; then
213                logout () { end_session && exit; }              # logout for X
214        else
215                logout () { kill -HUP $XSESSION && exit; }      # logout for X
216        fi
217fi
218
219#   aliases dealing with adding locker programs
220
221add_flags=
222add () { eval "$( /bin/athena/attach -Padd -b $add_flags "$@" )" ; }
223
224alias setup='echo "setup is not supported in bash yet"'
225
226
227# All of the bash initializing commands above can be overridden by using
228# "unset" or "unalias" commands (or by changing things using "set" or
229# "alias" again) in your ~/.bashrc.mine file, which is sourced here.
230# ~/.bashsrc.mine is not sourced if the xlogin "Ignore your customizations"
231# option was selected to begin the session.
232
233if [ "${NOCALLS+set}" != set -a -r ~/.bashrc.mine ]; then
234        . ~/.bashrc.mine
235fi
Note: See TracBrowser for help on using the repository browser.