Friday, July 25, 2008

.bashrc script - have fun with my bash script on unix

export PATH=/usr/bin:\
/usr/sbin:\
/usr/sfw/bin:\
/usr/sfw/sbin:\
$ANT_HOME/bin:\
/net/flashy.red.iplanet.com/export/d1/S11/SUNWspro/bin:\
/home/la204265/installations/SunStudio12/SUNWspro/bin:\
$JAVA_HOME/bin:\
/bin:/sbin:\
/usr/ccs/bin:\
/usr/proc/bin:\
/usr/platform/sun4u/sbin:\
/.secure/bin:\
/.secure/arch/sparc_sun_solaris2.3:\
/usr/local/bin:\
/usr/local/sbin:\
/usr/local/netscape:\
/usr/dist/exe:\
~/bin:\
/tools/ns-arch/sparc_sun_solaris2.10/bin:\
$PATH

export MANPATH=/usr/man:\
/usr/dt/man:\
/usr/openwin/share/man:\
/usr/local/man:\
/export/man:$MANPATH

export LD_LIBRARY_PATH=/usr/lib/mps:\
/usr/lib:\
/tools/ns-arch/soft/gcc-3.2.1/run/default/sparc_sun_solaris2.10/lib:\
/usr/local/lib:\
/lib:\
/usr/X/lib:\
/usr/ucblib:\
/usr/suntools/internal/SUNWspro/lib:\
/usr/local/ssl/lib:\
/usr/local/lib/gtk/themes/engines:\
/usr/local/ssl/lib:\
/net/flashy.sfbay/usr/re/tools/sparc/lib:\
$LD_LIBRARY_PATH

export CVSROOT=:pserver:la204265@jescvs.sfbay.sun.com:/m/src

export ANT_HOME=/home/la204265/work/tools/ant/apache-ant-1.7.0

export JAVA_HOME=/share/builds/components/jdk/1.5.0/SunOS
export JAVAHOME=/share/builds/components/jdk/1.5.0/SunOS
export JDK14_COMPILER_PATH=/share/builds/components/jdk/1.4.1/SunOS

export CVS_AM71_TAG="cvs co -r AM_MAIN_BRANCH DSAME"
export CVS_AM70_TAG="cvs co -r DSAME70_PATCH_BRANCH DSAME"
export CVS_AM63_TAG="cvs co -r DSAME63_RTM_BRANCH DSAME"
export CVS_AGENT22_TAG="cvs co -r WebAgents_22_RTM_Branch Agents"
export CVS_AGENT21_TAG="cvs co -r DSAMEagents21_sustaining_branch Agents"
export CVS_CHECKIN_FORMAT="cvs commit -m 'Bug: Esc: CRT: Review:' filename"
export ENV_ECLIPSE="~/tools/eclipse/eclipse -vmargs -Xmx700M"

export SUNSTUDIO_12=/home/la204265/installations/SunStudio12/SUNWspro/bin/sunstudio

export VISUAL=vi
export EDITOR=vi
export TETEXDIR=/usr/local/teTeX
export INFOPATH=$TETEXDIR/info

function get_xserver ()
{
echo $(hostname)

if [[ $(hostname) == "muir" ||
$(hostname) == "mojave" ||
$(hostname) == "lassen" ||
$(hostname) == "avatar" ||
$(hostname) == "koval" ]]; then
DISPLAY="avatar.red.iplanet.com:0.0"
fi
}

if [ -z ${DISPLAY:=""} ]; then
get_xserver
fi

export DISPLAY

#---------------
# Some settings
#---------------

ulimit -S -c 0 # Don't want any coredumps
set -o notify
set -o noclobber
set -o ignoreeof
#set -o nounset
#set -o xtrace # Useful for debuging

# Enable options:
shopt -s cdspell
shopt -s cdable_vars
shopt -s checkhash
shopt -s checkwinsize
shopt -s mailwarn
shopt -s sourcepath
shopt -s no_empty_cmd_completion # bash>=2.04 only
shopt -s cmdhist
shopt -s histappend histreedit histverify
shopt -s extglob # Necessary for programmable completion

# Disable options:
shopt -u mailwarn
unset MAILCHECK # I don't want my shell to warn me of incoming mail

export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n'
export HISTIGNORE="&:bg:fg:ll:h"
export HOSTFILE=$HOME/.hosts # Put a list of remote hosts in ~/.hosts

#-----------------------
# Greeting, motd etc...
#-----------------------

# Define some colors first:
red='\e[0;31m'
RED='\e[1;31m'
blue='\e[0;34m'
BLUE='\e[1;34m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
NC='\e[0m' # No Color
# --> Nice. Has the same effect as using "ansi.sys" in DOS.

# Looks best on a black background.....
echo -e "${CYAN}This is BASH ${RED}${BASH_VERSION%.*}\
${CYAN} - DISPLAY on ${RED}$DISPLAY${NC}\n"
date
if [ -x /usr/games/fortune ]; then
/usr/games/fortune -s # makes our day a bit more fun.... :-)
fi

function _exit() # function to run upon exit of shell
{
echo -e "${RED}Hasta la vista, baby${NC}"
}

trap _exit EXIT

#---------------
#---------------
# Shell Prompt
#---------------

if [[ "${DISPLAY#$HOST}" != ":0.0" && "${DISPLAY}" != ":0" ]]; then
HILIT=${red} # remote machine: prompt will be partly red
else
HILIT=${cyan} # local machine: prompt will be partly cyan
fi

alias cls=clear
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# -> Prevents accidentally clobbering files.
alias mkdir='mkdir -p'

alias h='history'
alias j='jobs -l'
alias r='rlogin'
alias rt='rlogin -l root'
alias rl='rlogin -l la204265'
alias which='type -all'
alias ..='cd ..'
alias path='echo -e ${PATH//:/\\n}'
alias print='/usr/bin/lp -o nobanner -d $LPDEST'
# Assumes LPDEST is defined
alias pjet='enscript -h -G -fCourier9 -d $LPDEST'
# Pretty-print using enscript
alias background='xv -root -quit -max -rmode 5'
# Put a picture in the background
alias du='du -kh'
alias df='df -kTh'

# The 'ls' family (this assumes you use the GNU ls)
alias la='ls -Al' # show hidden files
alias ls='ls -hF' # add colors for filetype recognition
alias lx='ls -lXB' # sort by extension
alias lk='ls -lSr' # sort by size
alias lc='ls -lcr' # sort by change time
alias lu='ls -lur' # sort by access time
alias lr='ls -lR' # recursive ls
alias lt='ls -ltr' # sort by date
alias lm='ls -al |more' # pipe through 'more'

alias tree='tree -Csu' # nice alternative to 'ls'

# tailoring 'less'
alias more='less'
export PAGER=less
export LESSOPEN='|/usr/bin/lesspipe.sh %s 2>&-'
# Use this if lesspipe.sh exists.
export LESS='-i -N -w -z-4 -g -e -M -X -F -R -P%t?f%f \
:stdin .?pb%pb\%:?lbLine %lb:?bbByte %bb:-...'

# spelling typos - highly personnal :-)
alias xs='cd'
alias vf='cd'
alias moer='more'
alias moew='more'
alias kk='ll'

#----------------
# a few fun ones
#----------------

function xtitle ()
{
case "$TERM" in
*term | rxvt)
echo -n -e "\033]0;$*\007" ;;
*)
;;
esac
}

# aliases...
alias ecl='/home/la204265/tools/eclipse/eclipse -vmargs -Xmx700M'
alias top='xtitle Processes on $HOST && top'
alias make='xtitle Making $(basename $PWD) ; make'
alias ncftp="xtitle ncFTP ; ncftp"

remoteon

No comments: