bashrc
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| bashrc [2007/02/28 10:26] – andi | bashrc [2010/04/28 18:45] (current) – 92.195.193.18 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== ~/.bashrc ====== | ||
| + | This is my '' | ||
| + | |||
| + | <code bash bashrc> | ||
| + | # Andi's .bashrc | ||
| + | |||
| + | # setup path | ||
| + | export PATH=${HOME}/ | ||
| + | |||
| + | # where' | ||
| + | export PILOTPORT=/ | ||
| + | |||
| + | # be sure to do to all this on interactive shells only | ||
| + | if [ " | ||
| + | # load system defaults | ||
| + | if [ -f / | ||
| + | . / | ||
| + | fi | ||
| + | |||
| + | # handy file conversion tools | ||
| + | alias dos2unix=" | ||
| + | alias unix2dos=" | ||
| + | alias bomstrip=" | ||
| + | |||
| + | # 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' | ||
| + | export GREP_OPTIONS=' | ||
| + | |||
| + | # color in man pages http:// | ||
| + | export LESS_TERMCAP_mb=$' | ||
| + | export LESS_TERMCAP_md=$' | ||
| + | export LESS_TERMCAP_me=$' | ||
| + | export LESS_TERMCAP_se=$' | ||
| + | export LESS_TERMCAP_so=$' | ||
| + | export LESS_TERMCAP_ue=$' | ||
| + | export LESS_TERMCAP_us=$' | ||
| + | |||
| + | # better safe than sorry | ||
| + | alias cp='cp -i' | ||
| + | alias rm='rm -i' | ||
| + | alias mv='mv -i' | ||
| + | |||
| + | # cleanup firefox 3 dbs | ||
| + | alias ffclean=' | ||
| + | |||
| + | # current git branch for prompt below | ||
| + | # http:// | ||
| + | parse_git_branch() { | ||
| + | git branch 2> /dev/null | sed -e '/ | ||
| + | } | ||
| + | # has current branch unrecorded changes? | ||
| + | # http:// | ||
| + | parse_git_dirty() { | ||
| + | git diff --quiet HEAD &>/ | ||
| + | [[ $? == 1 ]] && echo " | ||
| + | } | ||
| + | |||
| + | # set a fancy prompt and xterm title | ||
| + | shopt -s checkwinsize | ||
| + | if [ " | ||
| + | if [ " | ||
| + | PS1=' | ||
| + | else | ||
| + | PS1=' | ||
| + | |||
| + | fi | ||
| + | else | ||
| + | PS1=' | ||
| + | fi | ||
| + | |||
| + | # enable programmable bash completion | ||
| + | if [ -f / | ||
| + | . / | ||
| + | fi | ||
| + | |||
| + | # ssh keymanager - see http:// | ||
| + | if [ -e / | ||
| + | keychain -q ~/ | ||
| + | if [ -e ~/ | ||
| + | . ~/ | ||
| + | fi | ||
| + | if [ -e ~/ | ||
| + | . ~/ | ||
| + | fi | ||
| + | fi | ||
| + | |||
| + | # daily temp dir | ||
| + | export TD=" | ||
| + | td(){ | ||
| + | td=$TD | ||
| + | if [ ! -z " | ||
| + | td=" | ||
| + | fi | ||
| + | mkdir -p $td; cd $td | ||
| + | unset td | ||
| + | } | ||
| + | |||
| + | # set a sane editor | ||
| + | if [ -e / | ||
| + | export EDITOR=/ | ||
| + | alias vi=/ | ||
| + | fi | ||
| + | |||
| + | # print a fortune cookie | ||
| + | if which fortune >/ | ||
| + | if [ " | ||
| + | echo -en " | ||
| + | fortune -a -s | ||
| + | echo -en " | ||
| + | else | ||
| + | fortune -a -s | ||
| + | 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 < | ||
| + | $> unix2dos < | ||
| + | |||
| + | Strip UTF-8 byte order marks | ||
| + | |||
| + | $> bomstrip < | ||
| + | |||
| + | Change into a temp directory named after the todays date (create if nessary): | ||
| + | |||
| + | $> td | ||
| + | |||
| + | Change into yesterday' | ||
| + | |||
| + | $> td -1 | ||
