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 home=$(dirname ${BASH_ARGV[0]})
24 # Now set $HOME if $home is different.
26 if [ "$HOME" != "$home" ]; then
30 # Set ARCHITECTURE of the machine
32 if [[ $KERNEL = CYGWIN* ]]; then
33 export ARCHITECTURE=cygwin
34 elif [ $KERNEL = "Linux" ]; then
35 export ARCHITECTURE=linux
36 elif [ $KERNEL = "SunOS" ]; then
37 export ARCHITECTURE=sun
38 elif [ $KERNEL = "FreeBSD" ]; then
39 export ARCHITECTURE=$KERNEL
41 export ARCHITECTURE=''
42 echo "Warning: Unknown architecture ($KERNEL)"
45 # Architectual differences (AKA Silly Sun)
46 if [ $ARCHITECTURE = "sun" ]; then
47 alias id=/usr/xpg4/bin/id
48 alias tr=/usr/xpg4/bin/tr
50 export id=/usr/xpg4/bin/id
54 if [ -f "$HOME/.rc/set_colors" ]; then
55 source "$HOME/.rc/set_colors"
57 echo "Warning: ~/.rc/set_colors does not exist!"
60 # Check to see if we're interactive
61 if [[ $- = *i* ]]; then
62 export interactive=true
64 export interactive=false
70 if [ "$TERM" = "" -o \
71 "$TERM" = "unknown" -o \
72 "$TERM" = "dialup" -o \
73 "$TERM" = "network" ]; then
74 if [ "$interactive" = "true" ]; then
75 eval $(ttytype -s -a -t ansi -t hp)
79 # System dependent variables.
80 if [ -f "$HOME/.rc/system" ]; then
81 source "$HOME/.rc/system"
83 echo "Warning ~/.rc/system does not exist!"
84 export SYSNAME="*Unknown Systemname*:"
88 # Note: I don't like doing this but an alias doesn't work...
89 if [ $ARCHITECTURE = "sun" ]; then
97 if [ "$interactive" = "true" ]; then
98 stty tostop intr ^C kill ^X susp ^Z erase ^H -inpck -istrip -ixany -echok -echonl
102 adm_base=${adm_base:-/opt/clearscm}
105 adm_fpath=${adm_fpath:-$adm_base/functions}
108 if [ -f "$adm_fpath/common" ]; then
109 source "$adm_fpath/common"
111 : echo "Warning: Cannot find $adm_fpath/common!"
114 # Source bash_completion (if present) (too slow for Windows)
115 if [ -r /etc/bash_completion -a $ARCHITECTURE != "cygwin" ]; then
116 source /etc/bash_completion
119 if [ -x ~/.rc/logout ]; then
120 trap "~/.rc/logout" 0
124 if [ -f ~/.rc/clearcase ]; then
125 source ~/.rc/clearcase
129 if [ -f ~/.rc/multisite ]; then
130 source ~/.rc/multisite
134 if [ -f ~/.rc/git ]; then
138 # Import shell functions:
139 if [ -f ~/.rc/functions ]; then
140 source ~/.rc/functions
156 if [ $ARCHITECTURE = "FreeBSD" ]; then
159 if [ -f ~/.rc/dircolors ]; then
160 if type -p dircolors > /dev/null; then
161 eval $(dircolors -b ~/.rc/dircolors)
165 if [ $ARCHITECTURE = "sun" ]; then
166 # Ugh! --color doesn't work on braindead SUN
169 alias ls="ls -F --color=auto"
174 alias whence="type -p"
177 if [ $ARCHITECTURE = "cygwin" ]; then
181 if [ -f "$SYSTEMDRIVE/Perl64/bin/perl" ]; then
182 alias asperl="$SYSTEMDRIVE/Perl64/bin/perl"
185 if [ -f "$SYSTEMDRIVE/Perl/bin/perl" ]; then
186 alias asperl="$SYSTEMDRIVE/Perl64/bin/perl"
189 if [ $(locale -a | grep -c en_US.utf8) != 0 ]; then
190 export LANG=en_US.utf8
195 if [ $(type -p vim) ]; then
199 if [ $(type -p ncftp) ]; then
201 alias ftpput=ncftpput
202 alias ftpget=ncftpget
205 #alias grep="grep -d skip"
207 if [ "$TERM" = "hpterm" -o \
209 "$TERM" = "dtterm" -o \
210 "$TERM" = "sun-color" -o \
211 "$TERM" = "vt100" -o \
212 "$TERM" = "vt220" -o \
213 "$TERM" = "xterm" -o \
214 "$TERM" = "cygwin" ]; then
221 if [ -x $(type -p less) ]; then
222 export LESS=eiXP"?f%f :[stdin] .?pt(%pt\%):?bt(%bt bytes):-.."
223 alias more="less -sr"
224 export PAGER="less -sr"
230 export PS4='${0##*/} line $LINENO:'
235 if [ "$TERM" = "dtterm" ]; then
241 export MAIL=/var/mail/$USER
244 export PERLCRITIC=~/.rc/perlcriticrc
245 export PERLTIDY=~/.rc/perltidyrc
250 alias vbs="cscript //nologo"
253 if [ -f ~/.rc/set_path ]; then
254 source ~/.rc/set_path
256 echo "Warning: ~/.rc/set_path does not exist!"
259 # Color man pages with yellow keywords
260 export LESS_TERMCAP_md=$'\e[1;33m'
262 # If /opt/clearscm/lib is around then set PERL5LIB
263 if [ -d /opt/clearscm/lib ]; then
264 export PERL5LIB="$PERL5LIB:/opt/clearscm/lib"
267 # Client specific customizations
268 for script in $(\ls ~/.rc/client_scripts); do
269 # This is not working as long as ACLs are not supported from the remote
270 # NetApp. This happens at some clients where the home directory is on a
271 # Netapp and they do not support NTFS ACLs properly. We cannot determine
272 # if the script is executable.
273 #if [ ! -d ~/.rc/client_scripts/$script ]; then
274 if [ -x ~/.rc/client_scripts/$script -a \
275 ! -d ~/.rc/client_scripts/$script ]; then
276 source ~/.rc/client_scripts/$script
280 # Set display to local
281 export DISPLAY=${DISPLAY:-:0}
283 # Reset home in case it changed
286 # Now go home (in case we were not autmatically cd'ed there)
287 if [ $(id -u) -ne 0 ]; then