my bashrc ;)

Everybody who loves bash are welcome to use my bashrc :)

#--------------------------------------------------------------------
# $Id: bashrc,v 1.7 2007/10/08 21:33:00 drscream Exp $
# Copyright 2007 Frubar Network (drscream@frubar.net)
#--------------------------------------------------------------------

##########################################################################
# Test for an interactive shell.
if [[ $- != *i* ]] ; then
    # Shell is non-interactive.  Be done now!
    return
fi
##########################################################################

# functions
function sshs {
    ssh $@ -t screen
}
function root {
    sudo su -c \
    '/bin/bash --rcfile /home/${SUDO_USER}/.bashrc'
}

function runfortune {
    if [[ $(which fortune 2>/dev/null) ]]; then
        echo; fortune -s; echo
    fi
}

# aliases
alias ls='ls --color=auto'
alias ll='ls -l'
alias la='ls -la'
alias grep='grep --color=auto'
alias kwrite='kwrite 2>/dev/null &'
alias cal='cal -m'
alias screen='screen -RD'
#alias ssh='sshs'

# dir colors
if [[ -f ${HOME}/.dir_colors ]]; then
    eval $(dircolors -b ${HOME}/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]]; then
    eval $(dircolors -b /etc/DIR_COLORS)
fi

# change the window title of X terminals
case ${TERM} in
    xterm*|rxvt*|Eterm|aterm|kterm|gnome)
        PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
        ;;
    screen)
        PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
        ;;
esac

# set default PS1 PS2
if [[ ${EUID} == 0 ]] ; then
    PS1='\[\033[0;31m\][\u@\h]\[\033[0m\]:\[\033[0;34m\]\w #\[\033[0m\] '
    PS2='root %> '
else
    PS1='\[\033[0;33m\][\u@\h]\[\033[0m\] \[\033[0;32m\]\w\[\033[0m\]\n % '
    PS2='%> '
    runfortune
fi

# nice env variables
VISUAL=/usr/bin/vim
EDITOR=${VISUAL}
PAGER=/usr/bin/less
LESSSECURE=1
LANG=en_US.utf8
LC_ALL=en_US.utf8
SSL_CERT_DIR=${HOME}/.certs/
PATH=${HOME}/.bin:$PATH
HOST=$(hostname | sed 's/[.].*//g')

export PROMPT_COMMAND PS1 PS2 VISUAL EDITOR PAGER LANG LC_ALL PATH LESSSECURE SSL_CERT_DIR

# keychain check and use
if [[ -x $(which keychain 2>/dev/null) ]]; then
    if [[ -f ${HOME}/.ssh/id_rsa ]]; then
        keychain --host ${HOST} -q ~/.ssh/id_rsa
        . ~/.keychain/${HOST}-sh
    fi
fi

# load special file if exists
if [[ -f ${HOME}/.doc.env/etc/bash/${HOST}.bashrc ]]; then
    source ${HOME}/.doc.env/etc/bash/${HOST}.bashrc
fi

download bashrc

Posted

November 17, 2007, 11:50 am

Tags

, , ,

More

Permalink

Comments

Send your comment by mail.