Typo.
[xremote.git] / xremote.sh
index ce16636..c093b62 100755 (executable)
@@ -35,7 +35,7 @@ function check_remote_is_defined () {
 
 function help () {
     cat <<EOF
-xremote.sh <script>
+xremote.sh <script> [arguments]
 
   This script takes a script as argument and executes it remotely in a
   temporary directory on a ssh-accessible server.
@@ -57,7 +57,7 @@ xremote.sh <script>
     @XREMOTE_PRE: ln -s /home/fleuret/data/pytorch ./data
 
   If no argument is provided to @XREMOTE_HOST, the environment
-  variable $XREMOTE_HOST is used instead
+  variable \$XREMOTE_HOST is used instead
 
   Contact <francois@fleuret.org> for comments.
 
@@ -81,6 +81,8 @@ main="$(basename "$1")"
 
 cd "$(dirname "$1")"
 
+shift
+
 trap cleanup_remote_tmp EXIT
 
 ######################################################################
@@ -142,7 +144,15 @@ else
     REMOTE_COMMAND="./${main}"
 fi
 
-ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ${REMOTE_COMMAND}"
+######################################################################
+
+# I find this slightly ugly ...
+for s in "$@"
+do
+  quoted_args="${quoted_args} \"${s}\""
+done
+
+ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ${REMOTE_COMMAND} ${quoted_args}"
 
 ######################################################################