~ cornfelt /.bashrc

export PATH="~/bin:$PATH"

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

# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
if [[ -f ~/.dir_colors ]]; then
        eval `dircolors -b ~/.dir_colors`
else
        eval `dircolors -b /etc/DIR_COLORS`
fi

# aliase
alias ll='ls -lFh --color=auto'
alias la='ls -lAhS --color=auto'
alias ls="ls --color=auto"

alias grep="grep --color=auto"
alias ll='ls -l --color=tty'
alias nano='nano -w'


# bunt machen
COLOR_RED="\[\e[31;40m\]"
COLOR_GREEN="\[\e[32;40m\]"
COLOR_YELLOW="\[\e[33;40m\]"
COLOR_BLUE="\[\e[34;40m\]"
COLOR_MAGENTA="\[\e[35;40m\]"
COLOR_CYAN="\[\e[36;40m\]"

COLOR_RED_BOLD="\[\e[31;1m\]"
COLOR_GREEN_BOLD="\[\e[32;1m\]"
COLOR_YELLOW_BOLD="\[\e[33;1m\]"
COLOR_BLUE_BOLD="\[\e[34;1m\]"
COLOR_MAGENTA_BOLD="\[\e[35;1m\]"
COLOR_CYAN_BOLD="\[\e[36;1m\]"

COLOR_NONE="\[\e[0m\]"

promptFunc()
{
    PREV_RET_VAL=$?;

    PS1=""

    if test `whoami` != "root"
    then
        PS1="${PS1}${COLOR_YELLOW_BOLD}\u${COLOR_NONE}"
    else
        PS1="${PS1}${COLOR_RED_BOLD}\u${COLOR_NONE}"
    fi

    PS1="${PS1}@${COLOR_YELLOW_BOLD}\h${COLOR_NONE}"
    PS1="${PS1}:${COLOR_YELLOW_BOLD}\w${COLOR_NONE} "

    if test $PREV_RET_VAL -eq 0
    then
        PS1="${PS1}${COLOR_GREEN_BOLD}\\$ ${COLOR_NONE}"
    else
        PS1="${PS1}${COLOR_RED_BOLD}\\$ [${PREV_RET_VAL}] ${COLOR_NONE}"
    fi
}

PROMPT_COMMAND=promptFunc


##################
#extract files eg: ex tarball.tar#
##################
ex () {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)   tar xjf $1        ;;
            *.tar.gz)    tar xzf $1     ;;
            *.bz2)       bunzip2 $1       ;;
            *.rar)       rar x $1     ;;
            *.gz)        gunzip $1     ;;
            *.tar)       tar xf $1        ;;
            *.tbz2)      tar xjf $1      ;;
            *.tgz)       tar xzf $1       ;;
            *.zip)       unzip $1     ;;
            *.Z)         uncompress $1  ;;
            *.7z)        7z x $1    ;;
            *)           echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

function vi() { scr vi $* ; }
function nano() { scr nano $* ; }
function man() { scr man $* ; }
function mysql() { scr mysql $* ; }
function ssh() { scr ssh $* ; }