## check if shell is interactive case "$-" in *i*) _bash_interactive="true" ;; *) _bash_interactive="false" ;; esac ## distchecker if [ -f /etc/SuSE-release ]; then DIST="suse" # SuSE elif [ -f /etc/redhat-release ]; then DIST="redhat" # Red Hat elif [ -f /etc/gentoo-release ] || [ -d /usr/portage ] || [ -f /usr/bin/emerge ]; then DIST="gentoo" # Gentoo fi if [ "$_bash_interactive" = "true" ]; then echo -e " \033[1;33m*\033[m \033[1;1mdistribution\033[m (guess): ${DIST}" fi case "${DIST}" in suse) ## suse sucks... if shopt -q login_shell; then # shell is a login shell ## exit if ~/.bash_profile isn't already read test -n "${_HOMEBASHRC}" && test -z "${_HOMEBASH_PROFILE}" && { return } || { # test -r /etc/profile && . /etc/profile true } else # shell is not a login shell test -z "${_HOMEBASHRC}" && _HOMEBASHRC=true fi if [ -z "${BASH_COMPLETION}" ]; then test -r /etc/profile.d/complete.bash && . /etc/profile.d/complete.bash fi # change the window title of (X) terminals case "${TERM}" in xterm*|rxvt|eterm) export PROMPT_COMMAND_TERM='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/${HOME}/~}\007"' ;; screen*) # export PROMPT_COMMAND_TERM='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/${HOME}/~}\033\\"' export PROMPT_COMMAND_TERM='echo -ne "\033k\033\134"' ;; esac ## default pager if [ -z "${LESS}" ]; then export LESS="-SMIR" export LESSKEY="/etc/lesskey.bin" export LESSOPEN="lessopen.sh %s" export LESSCLOSE="lessclose.sh %s %s" export LESS_ADVANCED_PREPROCESSOR="yes" export PAGER="less" fi ;; redhat) test -r /etc/bashrc && . /etc/bashrc test -z "${INPUTRC}" && export INPUTRC="/etc/inputrc" export PAGER="less" ;; gentoo) test -r /etc/profile && . /etc/profile test -r /etc/profile.d/bash-completion && . /etc/profile.d/bash-completion # change the window title of (X) terminals case "${TERM}" in xterm*|rxvt|eterm) export PROMPT_COMMAND_TERM='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/${HOME}/~}\007"' ;; screen*) # export PROMPT_COMMAND_TERM='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/${HOME}/~}\033\\"' export PROMPT_COMMAND_TERM='echo -ne "\033k\033\134"' ;; esac export PAGER="less" ;; *) # don't do anything ;; esac ## source bash prompt settings test -r ~/.bash_prompt && . ~/.bash_prompt ## source bash aliases test -r ~/.bash_alias && . ~/.bash_alias ## source bash functions test -r ~/.bash_functions && . ~/.bash_functions ## shell options shopt -s cdable_vars shopt -s cdspell shopt -s checkhash shopt -s checkwinsize shopt -s cmdhist shopt -s extglob shopt -s histappend shopt -s histreedit shopt -s histverify shopt -s hostcomplete shopt -s no_empty_cmd_completion ## cdable_vars, see above export W="/local/www" export P="/local/pub" export I="/local/int" ## misc settings test -f "${HOME}/.bcrc" && export BC_ENV_ARGS="${HOME}/.bcrc" export BROWSER="lynx" # browser export CDDA_DEVICE=2,1,0 # cd audio device export CDR_DEVICE=2,1,0 # cd recording device export CDR_SPEED=40 # cd recording speed # export CDPATH=".:~:/:/mnt:/usr/src" export COLORTERM=1 # for midnight commander export COLORFGBG="lightgray;black" # for s-lang programs export CVS_RSH="ssh" # default cvs remote shell export CVSEDITOR="/usr/bin/vim" # default cvs editor export CVSROOT="/local/cvs" # default cvs root export EDITOR="/usr/bin/vim" # default editor export GZIP="-9 -v --name" # compress best, be verbose, show filenames export BZIP2="-9 -v" # compress best, be verbose export HISTCONTROL="ignoredups" # ignore duplicate entries in the history test -d "${HOME}/.bash_history.d" || mkdir -p "${HOME}/.bash_history.d" export HISTFILE="${HOME}/.bash_history.d/${HOSTNAME}" export HISTFILESIZE=10000 # export HISTIGNORE="bg:cd:date:df:du:exit:fg:ll:ls:pwd:rehash:source:su:sudo:top:w" export HISTSIZE=10000 test -f "${HOME}/.inputrc" && export INPUTRC="${HOME}/.inputrc" export LANG="en_IE@euro" # english language with euro export LANGUAGE="${LANG}" export LC_ALL="de_DE@euro" # german locale stuff with euro test -d "${HOME}/bin" && export PATH="${HOME}/bin:${PATH}" export RSYNC_RSH="ssh" # default rsync remote shell export TZ="CET" # time zone export VERSION_CONTROL="numbered" # for RCS export WHOIS_SERVER="whois.antivir.de" export WHOIS_HIDE ## size limits # ulimit -c 20000 # only core-files less than 20 MB are written # ulimit -d 15000 # max data size of a program is 15 MB # ulimit -s 15000 # max stack size of a program is 15 MB # ulimit -m 30000 # max resident set size is 30 MB ## set the default user file-creation mask umask 077 ## colored file listings if [ -x /usr/bin/dircolors ]; then if [ -f ~/.dir_colors ]; then eval $(dircolors -b ~/.dir_colors); elif [ -f /etc/DIR_COLORS ]; then eval $(dircolors -b /etc/DIR_COLORS); fi fi ## ssh-keychain (http://www.gentoo.org/projects/keychain/) test -r ~/.keychain/${HOSTNAME}-sh && . ~/.keychain/${HOSTNAME}-sh ## ondir (http://ondir.sf.net) test -x "$(type -p ondir)" && (test -r /etc/ondirrc || test -r ~/.ondirrc) && { function cd() { builtin cd "$@" && eval $(ondir "${OLDPWD}" "${PWD}") } function pushd() { builtin pushd "$@" && eval $(ondir "${OLDPWD}" "${PWD}") } function popd() { builtin popd "$@" && eval $(ondir "${OLDPWD}" "${PWD}") } function ondir_cmd() { ONDIRDO="$1" ONDIRWD="$2" shift; shift; if [ "${_bash_interactive}" = "true" ]; then echo -e " \033[1;32m*\033[m \033[1;1mondir\033[m (${ONDIRDO} ${ONDIRWD}): $@" fi eval $@ } eval $(ondir /) }