for POSSIBLE_PATH_DIR in "$HOME/bin" "$HOME/afsbin"; do
[[ -d "$POSSIBLE_PATH_DIR" ]] && [[ -x "$POSSIBLE_PATH_DIR" ]] && export PATH="$PATH:$POSSIBLE_PATH_DIR"
done
if [[ -x /usr/local/bin/ls ]]; then
PATH=`echo $PATH | sed -e 's#\(.*\):/usr/local/bin#/usr/local/bin:\1#'`
fi
if [[ $- != *i* ]]; then
return
fi
if [[ "$USER" == "ajz3" || "$USER" == "crazyivan" ]]; then
IS_ANTHONY=true
PROMPT_DIRSTRING='$SWD'
OTHER_PROMPT_COMMAND='if [[ "$PWD" == "/" ]]; then SWD="/"; else CURRENT_BASENAME=`basename $PWD`; PARENT=`dirname $PWD`; if [[ "$PARENT" == "/" ]]; then SWD="/$CURRENT_BASENAME"; else PARENT_BASENAME=`basename $PARENT`; SWD="$PARENT_BASENAME/$CURRENT_BASENAME"; if [[ `dirname $PARENT` == "/" ]]; then SWD="/$SWD"; fi; fi; fi'
USERNAME_PITT=ajz3
USERNAME_DREAMHOST=crazyivan
else
IS_ANTHONY=false
PROMPT_DIRSTRING='\W'
OTHER_PROMPT_COMMAND='true'
USERNAME_PITT=crp11
USERNAME_DREAMHOST=crp11
fi
TODO
TODO
TODO
case $TERM in
screen)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
TERM_CAN_TITLE=true
;;
xterm-color|color_xterm|rxvt|Eterm|screen*)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
TERM_CAN_TITLE=true
;;
linux)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
TERM_CAN_TITLE=false
;;
xterm|vt100)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
TERM_CAN_TITLE=true
;;
*xterm*|eterm|rxvt*)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
TERM_CAN_TITLE=true
;;
*)
TERM_IS_COLOR=false
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
TERM_CAN_TITLE=false
;;
esac
if $TERM_IS_COLOR && ( dircolors --help && ls --color ) &> /dev/null; then
for POSSIBLE_DIR_COLORS in "$HOME/.dir_colors" "/etc/DIR_COLORS"; do
[[ -f "$POSSIBLE_DIR_COLORS" ]] && [[ -r "$POSSIBLE_DIR_COLORS" ]] && eval `dircolors -b "$POSSIBLE_DIR_COLORS"` && break
done
alias ls="ls --color=auto"
alias ll="ls --color=auto -l"
else
alias ls="ls -F"
alias ll="ls -lF"
fi
alias du="du -k"
[[ -f /etc/profile.d/bash-completion ]] && source /etc/profile.d/bash-completion
if $TERM_CAN_TITLE; then
PROMPT_CONTENT='${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}'
function _setPromptCommandToDisplayXTermTitle()
{
export PROMPT_COMMAND="$OTHER_PROMPT_COMMAND; echo -ne \"\033]0;$*\007\""
}
function _setScreenTitle()
{
echo -ne "\033k$*\033\\"
}
function title()
{
if [[ "$TERM" == "screen" ]]; then
_setScreenTitle "$*"
_setPromptCommandToDisplayXTermTitle "$* <[$WINDOW]$PROMPT_CONTENT>"
else
_setPromptCommandToDisplayXTermTitle "$* <$PROMPT_CONTENT>"
fi
}
function untitle()
{
if [[ "$TERM" == "screen" ]]; then
_setScreenTitle `basename $SHELL`
_setPromptCommandToDisplayXTermTitle "[$WINDOW]$PROMPT_CONTENT"
else
_setPromptCommandToDisplayXTermTitle "$PROMPT_CONTENT"
fi
}
untitle
else
export PROMPT_COMMAND="$OTHER_PROMPT_COMMAND"
fi
if $TERM_IS_COLOR; then
if [[ `whoami` = 'root' ]]; then
export PS1="\[\033[00m\033[01;31m\]\h \[\033[01;34m\]$PROMPT_DIRSTRING \\\$ \[\033[00m\]"
else
export PS1="\[\033[00m\033[01;32m\]\u@\h \[\033[01;34m\]$PROMPT_DIRSTRING \\\$ \[\033[00m\]"
fi
( echo dummyline | grep --color=auto dummyline &> /dev/null ) && alias grep="grep --color=auto"
else
if [[ `whoami` = 'root' ]]; then
export PS1="\h $PROMPT_DIRSTRING \\\$ "
else
export PS1="\u@\h $PROMPT_DIRSTRING \\\$ "
fi
TODO
fi
export PS2="> "
alias lynx='lynx -accept_all_cookies'
if which screen &> /dev/null; then
SCREENEXISTS=true
else
SCREENEXISTS=false
fi
if $TERM_NOT_RECOGNIZED_BY_SUN_UTILS; then
function _xtermalias()
{
which "$1" &> /dev/null && alias "$1"="TERM=xterm \"$1\""
}
if which lynx &> /dev/null; then
LYNXYEAR=`lynx -version | head -n 1 | sed -e 's/.*(.......//' | sed -e 's/.$//'`
if [[ $LYNXYEAR -le 2001 ]]; then
alias lynx='TERM=xterm lynx -accept_all_cookies'
fi
fi
LESSVERSION=`less --version | head -n 1 | sed -e 's/less //'`
if [[ `echo "n = 0; if ( $LESSVERSION < 381 ) n = 1; n;" | bc` -eq 1 ]]; then
_xtermalias less
fi
if [[ `uname` == 'SunOS' ]]; then
_xtermalias more
fi
case `top -v 2>&1 | head -n 1` in
*procps*)
;;
*)
_xtermalias top
;;
esac
if $SCREENEXISTS; then
SCREENMAJORVERSION=`screen --version | sed -e 's/^Screen version //' | sed -e 's/\..*$//'`
if [[ `echo "n = 0; if ( $SCREENMAJORVERSION <= 3 ) n = 1; n;" | bc` -eq 1 ]]; then
_xtermalias screen
fi
fi
if which pine &> /dev/null; then
PINEVERSION=`( pine -v | sed -e 's/^Pine //' | sed -e 's/ .*//' ) 2>/dev/null`
if [[ `echo "n = 0; if ( $PINEVERSION <= 4.56 ) n = 1; n;" | bc` -eq 1 ]]; then
_xtermalias pine
fi
fi
fi
export PERLIO=stdio
MANLOC=`which man`
if MANPAGER=false PAGER=true $MANLOC true; then
USES_MANPAGER_FOR_MAN=false
USES_PAGER_FOR_MAN=true
else
USES_MANPAGER_FOR_MAN=true
USES_PAGER_FOR_MAN=false
fi 2> /dev/null
if VIMLOC=`which vim 2> /dev/null`; then
VIMEXISTS=true
else
VIMEXISTS=false
fi
if $VIMEXISTS; then
TODO
function _printvimpagercommand()
{
cat <<-END
vim -R -M -c "map q :q<CR>" -c "set foldlevel=99" -c "set notitle" -
END
}
function _printvimmanpagercommand()
{
echo -n 'col -b | '
echo -n `_printvimpagercommand`
echo -n ' '
cat <<-END
-c "set ft=man" -c "let titlelnum = 1 | let pagetitle = \"\" | while pagetitle == \"\" | let pagetitle = matchstr(getline(titlelnum), \"[^ ]*$\") | let titlelnum = titlelnum + 1 | endwhile | let titlestring = pagetitle | execute \"silent !echo -ne \047\033];\" . titlestring . \" - man\007\047\"" -c "redraw!"
END
}
function _printfilterpagerforpagerprinter()
{
echo "perl -e 'if(-t STDOUT) { open(VIM, q{| `$1`}); while(<>) { print VIM; } close(VIM); } else { open(COL, q{| col -b}); while(<>) { print COL; } close(COL); }'"
}
function _printmanpager()
{
_printfilterpagerforpagerprinter _printvimmanpagercommand
}
function _printpager()
{
_printfilterpagerforpagerprinter _printvimpagercommand
}
if $USES_MANPAGER_FOR_MAN; then
export MANPAGER=`_printmanpager`
else
function _notermman()
{
( export PAGER="`_printmanpager`"; $MANLOC "$@" )
}
TODO
if $TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM; then
function man()
{
TERM=xterm-color _notermman "$@"
}
else
function man()
{
_notermman "$@"
}
fi
fi
TODO
TODO
TODO
export PAGER=`which less`
else
if $TERM_NOT_RECOGNIZED_BY_SUN_UTILS; then
TODO
LESSVERSION=`less --version | head -n 1 | sed -e 's/less //'`
if [[ `echo "n = 0; if ( $LESSVERSION < 381 ) n = 1; n;" | bc` -eq 1 ]]; then
_xtermalias man
fi
fi
TODO
export PAGER=`which less`
fi
function _xtermcoloralias()
{
which "$1" &> /dev/null && alias "$1"="TERM=xterm-color \"$1\""
}
TODO
VILOC=`readlink -f \`which vi\` 2> /dev/null`
if $TERM_NOT_RECOGNIZED_BY_SUN_UTILS; then
if [[ -n "$VILOC" && "$VIMLOC" != "$VILOC" ]]; then
_xtermcoloralias vi
fi
if VIEWLOC=`readlink -f \`which view\` 2> /dev/null` && [[ "$VIEWLOC" != "$VIMLOC" ]]; then
_xtermcoloralias view
fi
fi
TODO
if $VIMEXISTS; then
if $TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM; then
alias vim='TERM=xterm-color vim'
for PROG in ex view rvim rview vi vimdiff; do
if PROGLOC=`readlink -f \`which $PROG\` 2> /dev/null` && [[ "$VIMLOC" == "$PROGLOC" ]]; then
_xtermcoloralias "$PROG"
fi
done
fi
if [[ "$VIMLOC" != "$VILOC" ]]; then
if $TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM; then
alias vi='TERM=xterm-color vim'
else
alias vi='vim'
fi
fi
fi
for POSSIBLE_INPUTRC in "$HOME/.inputrc" "/etc/inputrc"; do
[[ -f "$POSSIBLE_INPUTRC" ]] && [[ -r "$POSSIBLE_INPUTRC" ]] && export INPUTRC="$POSSIBLE_INPUTRC" && break
done
LOGDIR="$HOME/.gaim/logs/aim/beigetangerine"
[[ -d $LOGDIR ]] && alias cdlogs="cd $LOGDIR"
HOSTNAME=`hostname`
[[ "$HOSTNAME" == 'unixs1.cis.pitt.edu' ]] || alias unixs="ssh $USERNAME_PITT@unix.cis.pitt.edu"
[[ "$HOSTNAME" == 'java1h.javalab.cs.pitt.edu' ]] || alias javalab="ssh $USERNAME_PITT@java1h.javalab.cs.pitt.edu"
[[ "$HOSTNAME" == 'baht' ]] || alias dreamhost="ssh $USERNAME_DREAMHOST@crazyivan.org"
shopt -s checkwinsize
shopt -s cdspell
export IGNOREEOF=100
if $SCREENEXISTS; then
alias attach='screen -raAd'
fi
if $VIMEXISTS; then
export EDITOR="$VIMLOC"
function vimwhich()
{
WHICH=`which "$@"` && vim "$WHICH"
}
fi
if FIREFOXLOC=`which firefox 2> /dev/null`; then
export BROWSER="$FIREFOXLOC"
fi
function llwhich()
{
WHICH=`which "$@"` && ll "$WHICH"
}
set -o notify
IGNORE='.keep:._keepme'
for D in CVS .svn; do
IGNORE="$IGNORE:$D:$D/:*/$D:*/$D/"
done
export FIGNORE="$IGNORE"
export GLOBIGNORE="$IGNORE"
TODO
function f()
{
A=`echo -n "find" "$@" "-not -path '*/"; echo -n $IGNORE | sed -e "s/:/*' -not -path '*/g"; echo "'"`
perl -e "system(q[$A]);";
}
TODO
function up()
{
cd `for I in \`seq 1 $1\`; do cd ..; done; pwd`
}
function hr()
{
if $TERM_IS_COLOR; then
echo -ne "\033[01;31m"
fi
for I in `seq 1 $COLUMNS`; do
echo -n '-'
done
if $TERM_IS_COLOR; then
echo -ne "\033[00m"
fi
echo
}
if SSHLOC=`which ssh 2> /dev/null`; then
export RSYNC_RSH="$SSHLOC"
fi