#!/bin/sh # # both -- execute a command on both machines here and FARMACHINE # in the corresponding directories [ -n "$echo" ] && set -x USAGE='both command' : ${ME='leavens'} : ${CYGDRIVEHOME="/cygdrive/d"} # `(cd $HOME; /bin/pwd)` : ${FARMACHINE='monroe.cs.ucf.edu'} : ${AWAY="$FARMACHINE:/home/$ME"} STATUS=0 # get part of directory name below $HOME or $ALTHOME fulldir=`pwd` case "$fulldir" in $HOME) below=. ;; *) below=`expr $fulldir : $HOME/'\(.*\)'` ;; esac case "$below" in 0|'') below=`expr $fulldir : $CYGDRIVEHOME/'\(.*\)'` ;; esac awaybelow="$below" case "$below" in 0|'') echo "can't both from $fulldir, not under $HOME" >&2 exit 1 ;; bin|bin/Obsolete|bat) awaybelow="WWW/Windows/$below" ;; *) ;; esac "$@" && ssh "$FARMACHINE" "(cd ~/'${awaybelow}'; $@)"