bashrc
This is an old revision of the document!
~/.bashrc
This is my .bashrc
# Andi's .bashrc # setup path export PATH=${HOME}/bin:${HOME}/programs/bin:${PATH} # where's my palm? export PILOTPORT=/dev/ttyUSB1 # be sure to do to all this on interactive shells only if [ "$PS1" ]; then # load system defaults if [ -f /etc/profile ]; then . /etc/profile fi # handy file conversion tools alias dos2unix="perl -pi -e 's/\r\n/\n/;'" alias unix2dos="perl -pi -e 's/\n/\r\n/;'" alias bomstrip="sed -i -s -e '1s/^\xef\xbb\xbf//'" # enable color support of ls and also add handy aliases eval `dircolors -b` alias ls='ls --color=auto' alias ll='ls -l' alias la='ls -A' alias l='ls -la' # color in man pages http://icanhaz.com/colors export LESS_TERMCAP_mb=$'\E[01;31m' export LESS_TERMCAP_md=$'\E[01;31m' export LESS_TERMCAP_me=$'\E[0m' export LESS_TERMCAP_se=$'\E[0m' export LESS_TERMCAP_so=$'\E[01;44;33m' export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[01;32m' # better safe than sorry alias cp='cp -i' alias rm='rm -i' alias mv='mv -i' # cleanup firefox 3 dbs alias ffclean='for f in ~/.mozilla/firefox/*/*.sqlite; do echo $f; sqlite3 $f "VACUUM;"; done' # current git branch for prompt below # http://techblog.floorplanner.com/2008/12/14/working-with-git-branches/ parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\[\1\]/' } # set a fancy prompt and xterm title shopt -s checkwinsize if [ ! -z "$COLORTERM" ]; then if [ "$USER" == "root" ]; then PS1="\[\033]2;\w\007\]\[\033[0;31m\]\u@\h:\w\\$\[\033[0;37m\] " else PS1='\[\033]2;\w\007\]\[\033[0;32m\]\u@\h\[\033[00;35m\]$(parse_git_branch)\[\033[0;32m\]:\w\\$\[\033[0;37m\] ' fi else PS1='\u@\h:\w\$ ' fi # enable programmable bash completion if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi # ssh keymanager - see http://notes.splitbrain.org/ssh if [ -e /usr/bin/keychain ]; then keychain -q ~/.ssh/id_dsa if [ -e ~/.ssh-agent-${HOSTNAME} ]; then . ~/.ssh-agent-${HOSTNAME} fi if [ -e ~/.keychain/${HOSTNAME}-sh ]; then . ~/.keychain/${HOSTNAME}-sh fi fi # use zssh if available if [ -e /usr/bin/zssh ]; then alias ssh='zssh'; fi # daily temp dir export TD="$HOME/temp/`date +'%Y-%m-%d'`" td(){ td=$TD if [ ! -z "$1" ]; then td="$HOME/temp/`date -d "$1 days" +'%Y-%m-%d'`"; fi mkdir -p $td; cd $td unset td } # set a sane editor if [ -e /usr/bin/vim ]; then export EDITOR=/usr/bin/vim alias vi=/usr/bin/vim fi # print a fortune cookie if which fortune >/dev/null; then if [ -z "$COLORTERM" ]; then fortune -a -s else echo -en "\033[0;36m" fortune -a -s echo -en "\033[0;37m" fi fi fi
Some infos
Besides a nice prompt and some sane defaults this bashrc defines some handy utils as well:
Convert DOS CRLFs to Unix LFs and vice versa:
$> dos2unix <files> $> unix2dos <files>
Strip UTF-8 byte order marks
$> bomstrip <files>
Change into a temp directory named after the todays date (create if nessary):
$> td
Change into yesterday's temp dir:
$> td -1
bashrc.1270368299.txt.gz · Last modified: 2010/04/04 08:04 by 92.195.154.51