uzix.{net,org}
· Home
· About me
· Photos
· cgvg
Uzi's .bashrc

A plain text version of this is also available. This is my current .bashrc setup (colored by Vim):

# .bashrc - Joshua Uziel - Feel free to use any part of this.

# The almighty $PATH
PATH="$HOME/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/X11R6/bin"

# Set our environment variables
export MAILCHECK=0
export EDITOR=vim
export VISUAL=$EDITOR
export PAGER=less
export LESS='-iMn'
export PRINTER=lp
export CVS_RSH=ssh

# Misc settings
umask 022                                       # Default file perm
set -o emacs                                    # Emacs key bindings
bind 'C-u:kill-whole-line'                      # Ctrl-U kills whole line
bind 'set bell-style visible'                   # No beeping
#bind 'set horizontal-scroll-mode on'           # Don't wrap
bind 'set show-all-if-ambiguous on'             # Tab once for complete
bind 'set visible-stats on'                     # Show file info in complete

# Prompt - special prompt for Xterms to set the window title.
case $TERM in
    xterm*)
        PS1='\[\033]0;\h\007\][\@] \h:\w\$ '
        ;;
    *)
        PS1='[\@] \h:\w\$ '
        ;;
esac

# Aliases
alias ls='ls --color=auto -CF'
alias pg='ps aux | grep'
alias gvim='gvim -fn 6x10'
alias bc='bc -ql'

# Functions
findgrep () {           # find | grep
        if [ $# -eq 0 ]; then
                echo "findgrep: No arguments entered."; return 1
        else
                # "{.[a-zA-Z],}*" instead of "." makes the output cleaner
                find {.[a-zA-Z],}* -type f | xargs grep -n $* /dev/null \
                                2> /dev/null
        fi
}

swap () {               # swap 2 filenames around
        if [ $# -ne 2 ]; then
                echo "swap: 2 arguments needed"; return 1
        fi

        if [ ! -e $1 ]; then
                echo "swap: $1 does not exist"; return 1
        fi

        if [ ! -e $2 ]; then
                echo "swap: $2 does not exist"; return 1
        fi

        local TMPFILE=tmp.$$ ; mv $1 $TMPFILE ; mv $2 $1 ; mv $TMPFILE $2
}

rot13 () {              # For some reason, rot13 pops up everywhere
        if [ $# -eq 0 ]; then
                tr '[a-m][n-z][A-M][N-Z]' '[n-z][a-m][N-Z][A-M]'
        else
                echo $* | tr '[a-m][n-z][A-M][N-Z]' '[n-z][a-m][N-Z][A-M]'
        fi
}

bashrc.html last modified July 11, 2003
Questions? Comments? Email me at uzi@uzix.org