Please bear with us as we work to restore functionality to dotfiles.org.
Some history hacks, some shopt options, $PS1. Calls my .aliases file. The usual stuff.
NOTE: I am still trying to get bash to share history among concurrent sessions. PROMPT_COMMAND='history -a; history -n' is not doing it for me.
## ~./bashrc ##
# executed by bash(1) for non-login shells. see
# /usr/share/doc/bash/examples/startup-files (in
# the package bash-doc) for more examples
# Interactive shell or GTFO
[ -z '$PS1' ] && return
## Here come the environment variables ##
# I have emacs --daemon set to startup with kde, but what I really want
# to do here is start the daemon if it's not already up - go ahead and
# do it if you think you're so fucking smart
export EDITOR='emacsclient -t' ALTERNATE_EDITOR='nano'
## cope is a set of color scripts for various shell utilities ##
# http://stuff.cytzol.org/cope/
# add the cope dir to the beginning of $PATH and reload it
PATH=/usr/share/perl5/vendor_perl/auto/share/dist/Cope:$PATH
export PATH
## history hacks ##
# Decent sized history
export HISTSIZE=2500
export HISTFILESIZE=2500
# Don't put duplicate lines in the history...
export HISTCONTROL=ignoredups
# ... and ignore same sucessive entries...
export HISTCONTROL=ignoreboth
# ... and ignore ls and cd (if they are called without arguments), and bg,
# fg, exit, and clear, _and_ any command prefaced with a space
export HISTIGNORE='&:clear:ls:cd:[bf]g:exit:[ t\]*'
# The next two lines are a hack to allow me to share history across shells
# Append history instead of overwriting...
shopt -s histappend
# ... and append and re-read the history every time a prompt is displayed
export PROMPT_COMMAND='history -a; history -n'
## some shopt options ##
# check the window size after each command and, if necessary, update the
# values of LINES and COLUMNS.
shopt -s checkwinsize
# correct minor spelling errors in cd
shopt -s cdspell
#include dotfiles in wildcard expansion, and match case-insensitively
shopt -s dotglob
shopt -s nocaseglob
# These next two come from the ubuntu default from way back in the day
# For all I know, they do aboslutely nothing
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|urxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac
## Ladies and gentlemen, $PS1 ##
PS1='\[\033[1;34m\][\t] \[\033[00m\][\u@\h:\w]\$ '
## tab completion ##
# enable programmable completion features (you don't need to enable
# this if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc, but it can't hurt).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
## aliases ##
if [ -f ~/.aliases ]; then
. ~/.aliases
fi
## putting the FUN back in functions ##
function extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
function psgrep() {
if [ ! -z $1 ] ; then
echo "Grepping for processes matching $1..."
ps aux | grep $1 | grep -v grep
else
echo "!! Need name to grep for"
fi
}
# cd and ls
function cl {
case $1 in
-) cd -;ls;return;;
-*) local o=$1; shift;;
esac
cd $* && ls $o
}
# pushd to a specified package's documentation directory and ls it
function doc
{
pushd "/usr/share/doc/$1" && ls
}