# dotfiles.org/~brendano/.bashrc - for the gnu bash shell
# brendan o'connor - brenocon at gmail
# amalgated together from various linux distros, howto's, and such
# not maintained well since i switched to zsh
# ------------- Environment and convenience vars (more in .profile) ------------
export SHELL=bash
export EDITOR=vim
#alias rmtil="find . -name '*~' | xargs rm -f"
alias rmtil="rm -f *~"
## . /usr/pubsw/etc/rational/purifyplus_setup.sh
## export umask=077
export PAGER="less"
#export PAGER="less -r"
alias less=$PAGER
alias les=$PAGER
alias kess=$PAGER
alias kes=$PAGER
alias zles=zless
alias vles=vless
export LESSCHARSET=iso8859 #else does hex codes for all above 160
# ------------------- Commandline stuff -------------------------------
if [ "$PS1" ]; then
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
shopt -s cdspell \
cmdhist \
no_empty_cmd_completion \
nocaseglob \
checkwinsize \
alias ls='ls --color=auto'
alias ll='ls --color=auto -l'
alias l='ls --color=auto -lA'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
if [ $TERM = nxterm ]; then
export TERM=xterm-color
fi
# if [ $TERM = xterm -o $TERM = xterm-color -o $TERM = rxvt-cygwin -o $TERM = linux -o $TERM = rxvt -o $TERM = rxvt-cygwin ]; then
if [ `uname` = Linux ]; then
# enable color support of ls and also add handy aliases
eval `dircolors -b`
fi
# Prompt code adapted from Martin Frost.
# See what host we're coming from.
## whattty=`tty | sed 's,/dev/,,'`
## fromhost=`who|grep "$whattty "|sed -n 's,.*(\([^:]*\)).*,\1,p'`
## fromhost=`echo $fromhost | tr "[A-Z]" "[a-z]" | sed 's/\..*//g'`
# Use parens if not via ssh, brackets to mean incoming encrypted.
## sshl="("; sshr=")"
## if [ -z "$SSH_CLIENT" ]; then sshl="<"; sshr=">"; fi
## if [ "$fromhost" != "" ]; then
## fromhost="$sshl$fromhost$sshr";
## fi
# if (! $?oldprompt) set oldprompt="$prompt" # dies on multiline prompt
# Make prompt include hostname, event number, and working directory,
# with comma for tcsh and period for csh.
## if (! $?SSH_CLIENT) then
## set exclama = \!.
## if ($?tcsh) set exclama = \%\!\,
## else
## # Two dots indicates via ssh.
## set exclama = \!\:
## if ($?tcsh) set exclama = \%\!\;
## endif
# Remove any domain suffixes like .Stanford.EDU and make it lower case.
hname=`echo "$HOSTNAME" | tr "[A-Z]" "[a-z]" | sed 's,\..*,,'`
#PS1='=== \u@\h (\t) \w\n$ '
#PS1='\u@\h:\w $ '
## PS1='\033[35m\u\h:\[\033[31m\w \033[32m(\t)\033[0m\]\n$ '
PS1='\033[35m\u@\h:\[\033[31m\w\033[0m\] $ '
## \033[32m(\t)\033[0m\]\n$ '
export PS1
# If this is an xterm set the title to user@host:dir
case $TERM in
cygwin* | *xterm*)
## PROMPT_COMMAND='echo -ne "\033]0;${hname} ${fromhost} ${PWD}\007"'
PROMPT_COMMAND='echo -ne "\033]0;${hname} ${fromhost} ${PWD/#$HOME/~}\007"'
;;
*)
;;
esac
## PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME}: ${PWD}\007"'
fi #if $PS1
function xtitle ()
{
case "$TERM" in
*term | rxvt)
echo -n -e "\033]0;$*\007" ;;
*)
;;
esac
}