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 # 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' # 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:\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://wiki.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 } # twitter client twitter(){ local user='myusername'; local pass='mypass'; local twit=`echo -n "$@"` if [ -z "$twit" ]; then echo 'Enter your twit and hit return' read twit fi echo -n 'wait...' curl -u"$user:$pass" -dstatus="$twit" https://twitter.com/statuses/update.xml >/dev/null 2>&1 && echo 'okay' } # print a fortune cookie if [ -e /usr/games/fortune ]; then if [ -z "$COLORTERM" ]; then /usr/games/fortune -a -s else echo -en "\033[0;36m" /usr/games/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.1206696114.txt.gz · Last modified: 2009/04/08 09:17 (external edit)