#-------------------------------------------------------------------- # $Id: bashrc,v 1.7 2007/10/08 21:33:00 drscream Exp $ # Copyright 2007 Frubar Network (drscream@frubar.net) #-------------------------------------------------------------------- # something improved by georg@weiss.tc ########################################################################## # Test for an interactive shell. if [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now! return fi ########################################################################## ## ## check user and homedir / bashdir ## if [ "$(uname)" == "Darwin" ]; then DOC_USERNAME=${USER} else DOC_USERNAME=$(stat -c %U $(readlink -f /proc/self/fd/0)) fi if [ "${DOC_USERNAME}" != "${USER}" ]; then DOC_HOME=$(grep "^${DOC_USERNAME}:" /etc/passwd | cut -d: -f 6) else DOC_HOME=${HOME} fi DOC_BASHDIR="${DOC_HOME}/.bash.d" export DOC_USERNAME DOC_HOME DOC_BASHDIR ## ## 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 # currently small darwin workaround test -r ${DOC_BASHDIR}/options && . ${DOC_BASHDIR}/options ## ## load special files if exists ## source_list=( /etc/profile.d/bash-completion ${DOC_BASHDIR}/options ${DOC_BASHDIR}/functions ${DOC_BASHDIR}/svn_functions ${DOC_BASHDIR}/svn_alias ${DOC_BASHDIR}/login ${DOC_BASHDIR}/prompt ${DOC_BASHDIR}/alias ${DOC_BASHDIR}/hosts/${HOST}.bashrc ) for (( s = 0 ; s < ${#source_list[@]} ; s++ )); do if [ ${#source_list[$s]} -eq 0 ]; then continue fi test -r ${source_list[$s]} && . ${source_list[$s]} done ## ## 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