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
44 elif [ $KERNEL = "Darwin" ]; then
45 export ARCHITECTURE=$KERNEL
47 export ARCHITECTURE=''
48 echo "Warning: Unknown architecture ($KERNEL)"
51 # Architectual differences (AKA Silly Sun)
52 if [ $ARCHITECTURE = "sun" ]; then
53 alias id=/usr/xpg4/bin/id
54 alias tr=/usr/xpg4/bin/tr
56 export id=/usr/xpg4/bin/id
60 if [ -f "$HOME/.rc/set_colors" ]; then
61 source "$HOME/.rc/set_colors"
63 echo "Warning: ~/.rc/set_colors does not exist!"
66 # Check to see if we're interactive
67 if [[ $- = *i* ]]; then
68 export interactive=true
70 export interactive=false
76 if [ "$TERM" = "" -o \
77 "$TERM" = "unknown" -o \
78 "$TERM" = "dialup" -o \
79 "$TERM" = "network" ]; then
80 if [ "$interactive" = "true" ]; then
81 eval $(ttytype -s -a -t ansi -t hp)
85 # System dependent variables.
86 if [ -f "$HOME/.rc/system" ]; then
87 source "$HOME/.rc/system"
89 echo "Warning ~/.rc/system does not exist!"
90 export SYSNAME="*Unknown Systemname*:"
94 # Note: I don't like doing this but an alias doesn't work...
95 if [ $ARCHITECTURE = "sun" ]; then
103 if [ "$interactive" = "true" ]; then
104 stty tostop intr ^C kill ^X susp ^Z erase ^H -inpck -istrip -ixany -echok -echonl
108 adm_base=${adm_base:-/opt/clearscm}
111 adm_fpath=${adm_fpath:-$adm_base/functions}
114 if [ -f "$adm_fpath/common" ]; then
115 source "$adm_fpath/common"
117 : echo "Warning: Cannot find $adm_fpath/common!"
120 # Source bash_completion (if present) (too slow for Windows)
121 if [ -r /etc/bash_completion -a $ARCHITECTURE != "cygwin" ]; then
122 source /etc/bash_completion
125 if [ -x ~/.rc/logout ]; then
126 trap "~/.rc/logout" 0
130 if [ -f ~/.rc/clearcase ]; then
131 source ~/.rc/clearcase
135 if [ -f ~/.rc/multisite ]; then
136 source ~/.rc/multisite
140 if [ -f ~/.rc/git ]; then
144 # Import shell functions:
145 if [ -f ~/.rc/functions ]; then
146 source ~/.rc/functions
155 if [ $ARCHITECTURE != 'Darwin' ]; then
156 if ! grep -qP '5\.(6|7|8|9|10)' /etc/*release; then
167 if [ $ARCHITECTURE = "FreeBSD" -o $ARCHITECTURE = "Darwin" ]; then
170 if [ -f ~/.rc/dircolors ]; then
171 if type -p dircolors > /dev/null; then
172 eval $(dircolors -b ~/.rc/dircolors)
176 if [ $ARCHITECTURE = "sun" ]; then
177 # Ugh! --color doesn't work on braindead SUN
180 alias ls="ls -F --color=auto"
185 alias whence="type -p"
188 if [ $ARCHITECTURE = "cygwin" ]; then
192 if [ -f "$SYSTEMDRIVE/Perl64/bin/perl" ]; then
193 alias asperl="$SYSTEMDRIVE/Perl64/bin/perl"
196 if [ -f "$SYSTEMDRIVE/Perl/bin/perl" ]; then
197 alias asperl="$SYSTEMDRIVE/Perl64/bin/perl"
200 if [ $(locale -a | grep -c en_US.utf8) != 0 ]; then
201 export LANG=en_US.utf8
206 if [ $(type -p vim) ]; then
210 if [ $(type -p ncftp) ]; then
212 alias ftpput=ncftpput
213 alias ftpget=ncftpget
216 #alias grep="grep -d skip"
218 if [ "$TERM" = "hpterm" -o \
220 "$TERM" = "dtterm" -o \
221 "$TERM" = "sun-color" -o \
222 "$TERM" = "vt100" -o \
223 "$TERM" = "vt220" -o \
224 "$TERM" = "xterm" -o \
225 "$TERM" = "xterm-256color" -o \
226 "$TERM" = "cygwin" ]; then
233 if [ -x $(type -p less) ]; then
234 export LESS=eiXP"?f%f :[stdin] .?pt(%pt\%):?bt(%bt bytes):-.."
235 alias more="less -sr"
236 export PAGER="less -sr"
242 export PS4='${0##*/} line $LINENO:'
247 if [ "$TERM" = "dtterm" ]; then
253 export MAIL=/var/mail/$USER
256 export PERLCRITIC=~/.rc/perlcriticrc
257 export PERLTIDY=~/.rc/perltidyrc
262 alias vbs="cscript //nologo"
265 if [ -f ~/.rc/set_path ]; then
266 source ~/.rc/set_path
268 echo "Warning: ~/.rc/set_path does not exist!"
271 # Color man pages with yellow keywords
272 export LESS_TERMCAP_md=$'\e[1;33m'
274 # If /opt/clearscm/lib is around then set PERL5LIB
275 if [ -d /opt/clearscm/lib ]; then
276 export PERL5LIB="$PERL5LIB:/opt/clearscm/lib"
280 if type lessfile > /dev/null 2>&1; then
284 # Client specific customizations
285 for script in $(\ls ~/.rc/client_scripts); do
286 # This is not working as long as ACLs are not supported from the remote
287 # NetApp. This happens at some clients where the home directory is on a
288 # Netapp and they do not support NTFS ACLs properly. We cannot determine
289 # if the script is executable.
290 #if [ ! -d ~/.rc/client_scripts/$script ]; then
291 if [ -x ~/.rc/client_scripts/$script -a \
292 ! -d ~/.rc/client_scripts/$script ]; then
293 source ~/.rc/client_scripts/$script
297 # Set display to local
299 export DISPLAY=${DISPLAY:-:0}
300 # Reset home in case it changed
303 # Now go home (in case we were not autmatically cd'ed there)
304 if [ $(id -u) -ne 0 ]; then