1 ################################################################################
3 # File: $RCSfile: bash_login,v $
4 # Revision: $Revision: 1.29 $
5 # Description: bash startup file
6 # Author: Andrew@DeFaria.com
7 # Created: Mon Aug 20 17:35:01 2001
8 # Modified: $Date: 2013/06/13 14:04:55 $
11 # (c) Copyright 2000-2005, Andrew@DeFaria.com, all rights reserved.
13 ################################################################################
14 # The following will set HOME, temporarily, to the directory of my $HOME so that
15 # somebody other than me can envoke my startup scripts. I use this mainly for
16 # when I become root with sudo -s and what a better environment that the bare
17 # bones root environment gives you. Note that for us to be effective one must
18 # source (or .) this file and if so the ${BASH_ARGV[0]} is the normal $0
19 if [ -n "${BASH_ARGV[0]}" ]; then
20 home=$(dirname ${BASH_ARGV[0]})
28 # Now set $HOME if $home is different.
30 if [ "$HOME" != "$home" ]; then
34 # Set ARCHITECTURE of the machine
36 if [[ $KERNEL = CYGWIN* ]]; then
37 export ARCHITECTURE=cygwin
38 elif [ $KERNEL = "Linux" ]; then
39 export ARCHITECTURE=linux
40 elif [ $KERNEL = "SunOS" ]; then
41 export ARCHITECTURE=sun
42 elif [ $KERNEL = "FreeBSD" ]; then
43 export ARCHITECTURE=$KERNEL
45 export ARCHITECTURE=''
46 echo "Warning: Unknown architecture ($KERNEL)"
49 # Architectual differences (AKA Silly Sun)
50 if [ $ARCHITECTURE = "sun" ]; then
51 alias id=/usr/xpg4/bin/id
52 alias tr=/usr/xpg4/bin/tr
54 export id=/usr/xpg4/bin/id
58 if [ -f "$HOME/.rc/set_colors" ]; then
59 source "$HOME/.rc/set_colors"
61 echo "Warning: ~/.rc/set_colors does not exist!"
64 # Check to see if we're interactive
65 if [[ $- = *i* ]]; then
66 export interactive=true
68 export interactive=false
74 if [ "$TERM" = "" -o \
75 "$TERM" = "unknown" -o \
76 "$TERM" = "dialup" -o \
77 "$TERM" = "network" ]; then
78 if [ "$interactive" = "true" ]; then
79 eval $(ttytype -s -a -t ansi -t hp)
83 # System dependent variables.
84 if [ -f "$HOME/.rc/system" ]; then
85 source "$HOME/.rc/system"
87 echo "Warning ~/.rc/system does not exist!"
88 export SYSNAME="*Unknown Systemname*:"
92 # Note: I don't like doing this but an alias doesn't work...
93 if [ $ARCHITECTURE = "sun" ]; then
101 if [ "$interactive" = "true" ]; then
102 stty tostop intr ^C kill ^X susp ^Z erase ^H -inpck -istrip -ixany -echok -echonl
106 adm_base=${adm_base:-/opt/clearscm}
109 adm_fpath=${adm_fpath:-$adm_base/functions}
112 if [ -f "$adm_fpath/common" ]; then
113 source "$adm_fpath/common"
115 : echo "Warning: Cannot find $adm_fpath/common!"
118 # Source bash_completion (if present) (too slow for Windows)
119 if [ -r /etc/bash_completion -a $ARCHITECTURE != "cygwin" ]; then
120 source /etc/bash_completion
123 if [ -x ~/.rc/logout ]; then
124 trap "~/.rc/logout" 0
128 if [ -f ~/.rc/clearcase ]; then
129 source ~/.rc/clearcase
133 if [ -f ~/.rc/multisite ]; then
134 source ~/.rc/multisite
138 if [ -f ~/.rc/git ]; then
142 # Import shell functions:
143 if [ -f ~/.rc/functions ]; then
144 source ~/.rc/functions
153 if ! grep -qP '5\.(6|7|8|9|10)' /etc/*release; then
163 if [ $ARCHITECTURE = "FreeBSD" ]; then
166 if [ -f ~/.rc/dircolors ]; then
167 if type -p dircolors > /dev/null; then
168 eval $(dircolors -b ~/.rc/dircolors)
172 if [ $ARCHITECTURE = "sun" ]; then
173 # Ugh! --color doesn't work on braindead SUN
176 alias ls="ls -F --color=auto"
181 alias whence="type -p"
184 if [ $ARCHITECTURE = "cygwin" ]; then
188 if [ -f "$SYSTEMDRIVE/Perl64/bin/perl" ]; then
189 alias asperl="$SYSTEMDRIVE/Perl64/bin/perl"
192 if [ -f "$SYSTEMDRIVE/Perl/bin/perl" ]; then
193 alias asperl="$SYSTEMDRIVE/Perl64/bin/perl"
196 if [ $(locale -a | grep -c en_US.utf8) != 0 ]; then
197 export LANG=en_US.utf8
202 if [ $(type -p vim) ]; then
206 if [ $(type -p ncftp) ]; then
208 alias ftpput=ncftpput
209 alias ftpget=ncftpget
212 #alias grep="grep -d skip"
214 if [ "$TERM" = "hpterm" -o \
216 "$TERM" = "dtterm" -o \
217 "$TERM" = "sun-color" -o \
218 "$TERM" = "vt100" -o \
219 "$TERM" = "vt220" -o \
220 "$TERM" = "xterm" -o \
221 "$TERM" = "cygwin" ]; then
228 if [ -x $(type -p less) ]; then
229 export LESS=eiXP"?f%f :[stdin] .?pt(%pt\%):?bt(%bt bytes):-.."
230 alias more="less -sr"
231 export PAGER="less -sr"
237 export PS4='${0##*/} line $LINENO:'
242 if [ "$TERM" = "dtterm" ]; then
248 export MAIL=/var/mail/$USER
251 export PERLCRITIC=~/.rc/perlcriticrc
252 export PERLTIDY=~/.rc/perltidyrc
257 alias vbs="cscript //nologo"
260 if [ -f ~/.rc/set_path ]; then
261 source ~/.rc/set_path
263 echo "Warning: ~/.rc/set_path does not exist!"
266 # Color man pages with yellow keywords
267 export LESS_TERMCAP_md=$'\e[1;33m'
269 # If /opt/clearscm/lib is around then set PERL5LIB
270 if [ -d /opt/clearscm/lib ]; then
271 export PERL5LIB="$PERL5LIB:/opt/clearscm/lib"
275 if type lessfile > /dev/null 2>&1; then
279 # Client specific customizations
280 for script in $(\ls ~/.rc/client_scripts); do
281 # This is not working as long as ACLs are not supported from the remote
282 # NetApp. This happens at some clients where the home directory is on a
283 # Netapp and they do not support NTFS ACLs properly. We cannot determine
284 # if the script is executable.
285 #if [ ! -d ~/.rc/client_scripts/$script ]; then
286 if [ -x ~/.rc/client_scripts/$script -a \
287 ! -d ~/.rc/client_scripts/$script ]; then
288 source ~/.rc/client_scripts/$script
292 # Set display to local
293 export DISPLAY=${DISPLAY:-:0}
295 # Reset home in case it changed
298 # Now go home (in case we were not autmatically cd'ed there)
299 if [ $(id -u) -ne 0 ]; then