# $Id$ # Bash customizations # Test for an interactive shell. if [[ $- != *i* ]] then # Shell is non-interactive. Be done now return fi export PATH="${HOME}/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/bin/wrappers:/usr/lib/colorgcc/bin:${PATH}" # Import and get default settings [ -f /etc/bashrc ] && source /etc/bashrc [ -f /etc/DIR_COLORS ] && eval `dircolors -b /etc/DIR_COLORS` [ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion [ -f /etc/bash_completion ] && source /etc/bash_completion [ -f /usr/local/etc/bash_completion ] && source /usr/local/etc/bash_completion [ -f /opt/local/etc/bash_completion ] && source /opt/local/etc/bash_completion [ -f ${HOME}/.bash_aliases ] && source ${HOME}/.bash_aliases [ -f ${HOME}/.bash_prompt ] && source ${HOME}/.bash_prompt [ -f ${HOME}/.inputrc ] && export INPUTRC=${HOME}/.inputrc [ -f /etc/debian_chroot ] && export LC_ALL=C # don't put duplicate lines in the history. See bash(1) for more options export HISTCONTROL=ignoredups # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # Use vim and vim-info plugin for man pager and info viewer if [ -f ${HOME}/.vimrc.more ] then info() { vim -u ${HOME}/.vimrc.more "+Info ${1}" +only; } export PAGER="sh -c \"col -b | view -u ${HOME}/.vimrc.more -\"" export MANPAGER="sh -c \"col -b | view -u ${HOME}/.vimrc.more -c 'set ft=man nolist' -\"" fi less () { if [ $# = 0 ] then vim -u ${HOME}/.vimrc.more --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - else file "$@" | grep "text" if [ $? = 0 ] then vim -u ${HOME}/.vimrc.more --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" else /usr/bin/less "$@" fi fi } # Simple cli calculator calc () { a=${1:-"print \"calc \\n\""}; echo "scale=4; ${a}" | bc; } # Colorize grep if echo hello|grep --color=auto l >/dev/null 2>&1 then export GREP_OPTIONS='--color=auto' export GREP_COLOR='1;32' fi # Change the window title of X terminals case $TERM in xterm*|rxvt|Eterm|eterm) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' ;; screen) PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"' ;; esac # Setup symlink so screen can reattach to ssh-agent if [ -z $STY ] && [ ! -z $SSH_AUTH_SOCK ] then ln -sf "$SSH_AUTH_SOCK" "$HOME/.ssh/ssh-agent-$USER-screen" fi # Tell me my fortune if which fortune >/dev/null 2>&1 then fortune fi # Set location of python shell startup file export PYTHONSTARTUP=$HOME/.pythonrc.py # .bashrc # vim:syntax=sh: # vim:sw=4:softtabstop=4:expandtab