# .bashrc -- executed by interactive shells # note that .bash_profile invokes this # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # From linux /etc/bashrc, which is not always there if [ "$PS1" ]; then # Attempt to set erase to what the terminal sends if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal stty erase `tput kbs` fi # This will set the xterm title case $TERM in xterm*|vt[12][0-9][0-9]) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' ;; *) ;; esac # ptw's variant on the prompt (I like timestamps) PS1="[\u@\h \W \t]\\$ " fi # Should share with .ssh/environment export PATH="$HOME/bin:/usr/local/bin:$PATH" export BAK=".," export CDPATH="./:~${USER}/" export EDITOR=emacsclient # Use this shell in emacs too export ESHELL=${SHELL} export HISTIGNORE='&:ls: ls *:[bf]g' export HISTFILESIZE=10000 export HISTSIZE=10000 export IGNOREEOF=5 export LESS=-ceij10JmnqsX export LOGFILE="${BAK}log" export MAKER=mmake export MAILER=mail export PAGER=less export XAPPLRESDIR=$HOME/.app-defaults # This makes svn work when you have non-ascii characters in a commit # message export LC_ALL=en_US # Fink setup if [ -f /sw/bin/init.sh ]; then # (After setting PATH so manpath will work) # set MANPATH empty so it will be computed by manpath export MANPATH="" source /sw/bin/init.sh fi # p4 settings if [ -f ~/.p4rc ]; then source ~/.p4rc fi # svn settings if [ -f ~/.svnrc ]; then source ~/.svnrc fi # OpenLaszlo settings if [ -f ~/.openlaszlorc ]; then source ~/.openlaszlorc fi export SGML_CATALOG_FILES="/usr/local/share/dtd/html40/HTML4.cat:/usr/local/share/dtd/xhtml/catalog" function decompile-swf() { for i in ${*:-*.swf}; do /usr/local/flasm16mac/flasm -d $i > ${i%.swf}.flasm ; done } # java function set-jdk() { sudo /usr/local/bin/jsettestjdk ${*:-1.3.1} } # cvs export CVS_RSH=/usr/bin/ssh # SQL alias mysql=/usr/local/mysql/bin/mysql alias mysqladmin=/usr/local/mysql/bin/mysqladmin # SVN if [ -f ~/OpenLaszlo/tools/trunk/svn/svn-bash.sh ]; then source ~/OpenLaszlo/tools/trunk/svn/svn-bash.sh fi alias svnmerge='${HOME}/OpenLaszlo/tools/trunk/svn/svnmerge.py' function svn-textfile () { svn propset svn:mime-type text/plain ${*} svn propset svn:eol-style native ${*} } function do-svn() { cmd=${1} shift case ${cmd} in = ) svn diff ${*} ;; c ) svn-commit ${*} ;; d ) svn-describe ${*} ;; e ) # Argument becomes new default export OL_CHANGE_NAME=${1:-${OL_CHANGE_NAME}} svn-editchange ${*} ;; p ) svn-pending ${*} ;; r ) svn-review ${*} ;; s ) svn status -q ${*} ;; u ) svn update ${*} ;; * ) echo '=(diff) Commit Describe Editchange Pendingchanges Reviewmail Status Update' esac } alias s='do-svn' # User specific aliases and functions function backup() { tail=${2##*/} head=${2%${tail}} ${1} ${head}${BAK}${tail} ${2} } function send-notification() { if zlocate ${1} ; then zwrite ${1} else ${MAILER:-mail} ${*} fi } function annotate-execution() { echo "# `date`" echo "cd $(pwd); ${*}" time ${SHELL} -c "${*}" } function log-execution() { annotate-execution "${*}" &> $LOGFILE < /dev/null } function notify-completion() { log-execution "${*}" tail ${LOGFILE} | send-notification ${USER} -s "${*}" } function background() { ( trap '' SIGHUP; notify-completion "${*}" ) & } function ssh-login() { ssh -f ${*} /usr/X11R6/bin/xterm -e bash -login } function ssh-vnc() { ssh ${*} -L 5900:localhost:5900 sudo /Applications/OSXvnc-0.7/OSXvnc.app/Contents/MacOS/OSXvnc-server -rfbport 5900 } function ssh-tunnel() { # resolv.conf won't exist if there is no network while [ -f /etc/resolv.conf ]; do date +'Connection started at %F %T %Z' (export TIMEFORMAT="Connection lost after %lR"; time ssh -N ${*}) done date +'No nework available at %F %T %Z' } function laszlo-tunnel() { # -g allows VMWare to share the forwardings ssh-tunnel -g \ -L 1666:perforce.corp.laszlosystems.com:1666 \ -L 32636:ldapsvr.corp.laszlosystems.com:636 \ -L 32389:ldapsvr.corp.laszlosystems.com:389 \ -L 32143:topaz:143 \ -L 32025:topaz:25 \ -L 34000:topaz:2000 \ -D 33080 ${*:-sf.laszlosystems.com} } function sync-site() { rsync ${1} -Cavuzb --rsh=ssh --exclude='.*' . trope@laguz.pair.com:~/public_html/${2} } alias ${BAK}=backup alias ${BAK}cp="${BAK} cp" alias ${BAK}diff="${BAK} diff" alias ${BAK}mv="${BAK} mv" alias d=dirs alias f=finger alias gr='grep -in' alias gh='history | grep -i' alias h='history 16' alias hi='history 80' alias j='jobs -l' alias l='ls -aFqC' alias ll='ls -aFlg' alias lt='laszlo-tunnel' alias m=${PAGER} alias ma='mk all' alias mk='background mmake' alias p2='pushd +2' alias p3='pushd +3' alias pd=pushd alias prt="enscript -k2r -P${PRINTER}" alias sl=ssh-login alias st=start-tunnels alias tb="tail -f ${LOGFILE}" alias z=suspend umask 002