~ jsnx
/.bashrc
The prompt has taken me well over two years to write, and works in Bourne shell as well as bash. One peculiarity of my path is the addition of './bin' -- any local bin/ directory will be used to search for commands.
#!/usr/bin/env bash
##
## So many years of fooling around...
##
##
[ -e $f ] && rm -rf $HISTFILE
bc="bash_completion"
if [[ `uname` = 'Linux' ]]
then
bc="/etc/${bc}"
alias l='ls --color'
alias ll='ls -lA --color'
elif [[ `uname` = 'FreeBSD' ]]
then
bc="/usr/local/etc/${bc}"
alias l='ls -G'
alias ll='ls -GlA'
else
bc="/etc/${bc}"
alias l='ls'
alias ll='ls -lA'
fi
for f in $bc /etc/profile
do
[ -f $f ] && source $f
done
alias go='pushd'
alias b='popd'
alias h='history'
alias r='rm -r'
alias c='clear'
alias t='tail -n 50'
alias g='egrep --color'
alias x='exit'
alias ri='ri -f ansi'
umask 002
set -o vi
## begin prompt of power ##############################################
# I used to have the prompt set up as a bunch of functions; but that
# didn't work very well with sh. Now, I have mastered the various
# levels of evaluation and quoting of the shell and can confidently
# write hideous macros!
DARK="\[\e[01;34m\]"
NORM="\[\e[01;32m\]"
FADE="\[\e[01;30m\]"
REST="\[\e[00;00m\]"
HIGH="\[\e[01;33m\]"
dir="pwd -P | awk '{ printf \"%-65.65s\", \$1 }'"
sub="sed -r 's/^/$NORM/ ; s|/|$FADE&$NORM|g ; s/:/$DARK&$NORM/g'"
t="date +%H:%M"
hist="history 1 | xargs echo '' | awk '{ printf \"%03.3d\", \$1 + 1 }'"
warn="[ $USER = root ] && echo -n '$HIGH' || echo -n '$FADE'"
bang="echo -ne '\x21'" ## this gives me a single '!' in bash and sh
prompt=" $DARK: \`$dir | $sub\` \`$warn;$bang;\`$NORM\`$hist\` \`$t | $sub\`
$DARK:\`$warn\`; $REST"
prepend=''
if [ "${TERM}" = "xterm" ]
then
my_tty=`tty | awk -F/ '{ print $3 $4}'`
xterm_title="\[\e]0;${my_tty} \u@\H\007\]"
prepend="${xterm_title}"
fi
#export PROMPT_COMMAND="export PS1=\"${prepend}${prompt}\""
export PS1="${prepend}${prompt}"
export PS2=' '
## end prompt of power ################################################
export EDITOR=vim
export TEXEDIT="${EDITOR} +%d %s"
export RUBYOPT="${RUBYOPT} -Ku"
export BROWSER=firefox
export HISTIGNORE="&:h:exit"
export PATH=$PATH:/sbin/:/usr/sbin/:$HOME/bin:./bin:.
export TZ=/usr/share/zoneinfo/America/Los_Angeles