function help () {
cat <<EOF
-xremote.sh <executable>
+xremote.sh <script>
This script takes a script as argument and executes it remotely in a
temporary directory on a ssh-accessible server.
case "${label}" in
+ EXEC)
+ check_remote_is_defined
+ REMOTE_EXEC="${value}"
+ ;;
+
PRE)
check_remote_is_defined
ssh < /dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ${value}"
echo "----------------------------------------------------------------------"
echo "-- On ${REMOTE_HOST}"
echo "----------------------------------------------------------------------"
-ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ./$(basename "${main}")"
+
+if [[ "${REMOTE_EXEC}" ]]
+then
+ REMOTE_COMMAND="${REMOTE_EXEC} ${main}"
+else
+ REMOTE_COMMAND="./${main}"
+fi
+
+ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ${REMOTE_COMMAND}"
echo "----------------------------------------------------------------------"
######################################################################