-export WORKDIR="$( \cd "$(\dirname "$0")" && \pwd )" # obtain the script's working directory.
-cd $WORKDIR
-
-SHUNIT_DIR=/home/fred/xsede/xsede_tests/shunit
+export THISDIR="$( \cd "$(\dirname "$0")" && /bin/pwd )" # obtain the script's working directory.
+if [[ ! "$0" =~ ^/.* ]]; then
+ # re-run the script with an absolute path if it didn't start out that way; otherwise,
+ # shunit is not happy with finding the script.
+ exec "$THISDIR/$(basename $0)" $*
+fi
+cd $THISDIR