# Local unison name if [ -r ~/.unison/name ]; then source ~/.unison/name fi # Always try the global profile (quietly) if [ -r /etc/profile ]; then source /etc/profile >/dev/null 2>&1 fi # Find grep GREP="" if [ -x /bin/grep ]; then GREP="/bin/grep" elif [ -x /sbin/grep ]; then GREP="/sbin/grep" elif [ -x /usr/bin/grep ]; then GREP="/usr/bin/grep" elif [ -x /usr/local/bin/grep ]; then GREP="/usr/local/bin/grep" elif [ -x /usr/local/sbin/grep ]; then GREP="/usr/local/sbin/grep" fi NO_PATH_MUNG=0 if [ -z "${GREP}" ] || [ ! -x "${GREP}" ]; then echo "Could not find grep -- using standard path" 1>&2 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" GREP="" elif ! echo "TEST" | "${GREP}" -E -q "^TEST$" >/dev/null 2>&1; then echo "grep is not usable -- keeping the default path in case we're on a funky host" 1>&2 GREP="" fi export GREP # Path Munger pathmunge () { if [ -z "${GREP}" ]; then return fi if [ ! -d "${1}" ]; then # Don't add the path, but don't complain either #echo "Directory does not exist: ${1}" 1>&2 return fi if ! echo "${PATH}" | "${GREP}" -E -q "(^|:)$1($|:)" && [ -d "${1}" ]; then if [ "${2}" == "after" ] ; then PATH="${PATH}:${1}" else PATH="${1}:${PATH}" fi export PATH fi } # Exec check execCheck() { NO_FIND=1 for i in `compgen -c "${1}"`; do if [ "${i}" == "${1}" ]; then NO_FIND=0 break fi done return $NO_FIND } # Add Fink to our ENV if [ -r /sw/bin/init.sh ]; then source /sw/bin/init.sh # Fink mucks too much with the path; start clean PATH="/bin:/usr/bin" pathmunge /sw/bin after pathmunge /sw/sbin after fi # Add MacPorts to our ENV if [ -x /opt/local/bin/port ]; then pathmunge /opt/local/bin pathmunge /opt/local/sbin fi # Ensure we have all our standard paths pathmunge /usr/X11/bin pathmunge /usr/X11R6/bin pathmunge /usr/local/sbin pathmunge /usr/local/bin pathmunge /usr/sbin pathmunge /usr/bin pathmunge /sbin pathmunge /bin # Include our local path pathmunge ~/bin pathmunge ~/bin/machines pathmunge ~/bin/vnc # Fix the retarded 10.7 default TERM if [ "${TERM}" == "xterm-256color" ]; then export TERM="xterm-color" fi #CVS CVS_RSH="ssh" BOTS_CVSROOT="zachk@release.dice.com:/usr/local/cvs/BOT_CVS" CJ_CVSROOT="zachk@release.dice.com:/usr/local/cvs/CJ_CVS" CVSROOT=$BOTS_CVSROOT export CVS_RSH CJ_CVSROOT BOTS_CVSROOT CVSROOT # Oracle ORACLE_HOME=/d01/app/oracle/product/8.1.7 LD_LIBRARY_PATH="${ORACLE_HOME}" TNS_ADMIN="" if [ ! -d "${ORACLE_HOME}" ]; then ORACLE_HOME=/opt/oracle/instantclient_11_1 TNS_ADMIN="${ORACLE_HOME}" LD_LIBRARY_PATH="" fi if [ ! -d "${ORACLE_HOME}" ]; then ORACLE_HOME=/opt/oracle/instantclient_10_2 TNS_ADMIN="${ORACLE_HOME}" LD_LIBRARY_PATH="" fi if [ ! -d "${ORACLE_HOME}" ] && [ "`uname -m`" == "i386" ]; then ORACLE_HOME=/Users/profplump/dice/instantclient_10_2 TNS_ADMIN="${ORACLE_HOME}" LD_LIBRARY_PATH="${ORACLE_HOME}" fi if [ ! -d "${ORACLE_HOME}" ]; then ORACLE_HOME=/Users/profplump/dice/instantclient10_1 TNS_ADMIN="${ORACLE_HOME}" LD_LIBRARY_PATH="${ORACLE_HOME}" fi if [ ! -d "${ORACLE_HOME}" ]; then ORACLE_HOME="" TNS_ADMIN="" LD_LIBRARY_PATH="" fi if [ -n "${ORACLE_HOME}" ]; then export ORACLE_HOME fi if [ -n "${TNS_ADMIN}" ]; then export TNS_ADMIN fi if [ -n "${LD_LIBRARY_PATH}" ]; then export LD_LIBRARY_PATH export DYLD_LIBRARY_PATH="${LD_LIBRARY_PATH}" fi # Java if [ ! -d "${JAVA_HOME}" ]; then JAVA_HOME="/usr/local/java/jdk1.6.0_18/" fi if [ ! -d "${JAVA_HOME}" ]; then JAVA_HOME="/usr/local/java/jre1.6.0_18/" fi if [ -n "${JAVA_HOME}" ]; then export JAVA_HOME pathmunge "${JAVA_HOME}/bin" after fi # If not running interactively, don't do anything else if [ -z "${PS1}" ]; then return fi # Bash HISTCONTROL=ignoredups HISTSIZE=1000 PS1='\[\033[01;32m\]\h \[\033[00m\]\[\033[01;34m\]\w\[\033[00m\] $?\$ ' if [ "`id -u 2>/dev/null`" == "0" ]; then PS1='\[\033[01;32m\]\h \[\033[00m\]\[\033[01;34m\]\w\[\033[00m\] $?# ' fi export HISTCONTROL HISTSIZE PS1 # Window resize shopt -s checkwinsize 2>/dev/null # LS color support if [ "${TERM}" != "dumb" ]; then if execCheck dircolors; then eval "`dircolors -b`" export LS_OPTIONS='--color=auto' alias ls='ls --color=auto' else # This doesn't always work, but it's safe when it does if ls -G >/dev/null 2>&1; then alias ls='ls -G' fi fi fi # Programatic completion if [ -f /etc/bash_completion ]; then source /etc/bash_completion fi # Lesspipe if execCheck lesspipe; then eval "$(lesspipe)" fi # Aliases alias pa="ps auxw" if ls -lah > /dev/null 2>&1; then alias la="ls -lah" else alias la="ls -la" fi # Local alises if [ -r ~/.aliases ]; then source ~/.aliases fi # Editor EDITOR="nano" if [ -z "${SSH_CLIENT}" ]; then EDITOR="mate_wait" fi if ! execCheck $EDITOR; then EDITOR="nano" fi if ! execCheck $EDITOR; then EDITOR="pico" fi if ! execCheck $EDITOR; then EDITOR="vim" fi if ! execCheck $EDITOR; then EDITOR="vi" fi if [ "${EDITOR}" == "vi" ]; then alias vim=vi fi export EDITOR # If not running a login shell, don't do anything else if [ -z "${GREP}" ] && [ -n "${PS1}" ]; then return elif ! shopt login_shell 2>/dev/null | "${GREP}" -q -i on; then return fi # If ssh-agent exists and hasn't run yet if execCheck ssh-add && execCheck ssh-agent; then ssh-add -L >/dev/null 2>&1 if [ $? -eq 2 ]; then exec ssh-agent bash fi fi # Screen #if execCheck screen && [ -z "${STARTED_SCREEN}" ] && [ -n "${SSH_TTY}" ]; then # export STARTED_SCREEN=1 # screen -D -RR && exit 0 #fi # Fortune if [ "${TERM}" != "dumb" ] && execCheck fortune; then echo fortune -a echo fi # Shortcuts function mkpwd() { [ "$2" == "0" ] && CHAR="[:alnum:]" || CHAR="[:graph:]" cat /dev/urandom | LC_ALL=C tr -cd "${CHAR}" | head -c ${1:-32} echo }