temporary directory on a ssh-accessible server.
It parses the script first to find embedded arguments which defines
temporary directory on a ssh-accessible server.
It parses the script first to find embedded arguments which defines
- the hostname on which to run it, the files to send, the files to
- get back when the execution is done, and commands to execute before
+ the hostname on which to run, the files to send, the files to get
+ back when the execution is over, and commands to execute before
running the executable remotely.
These arguments can appear multiple times, except the one that
running the executable remotely.
These arguments can appear multiple times, except the one that
[[ "${REMOTE_HOST}" ]] || REMOTE_HOST="${XREMOTE_HOST}"
[[ "${REMOTE_HOST}" ]] || (echo "xremote: No remote host specified." >&2 && exit 1)
REMOTE_DIR="$(ssh </dev/null "${REMOTE_HOST}" mktemp -d /tmp/xremote.from_"$(hostname)_$(date +%Y%m%d-%H%M%S)".XXXXXX)"
[[ "${REMOTE_HOST}" ]] || REMOTE_HOST="${XREMOTE_HOST}"
[[ "${REMOTE_HOST}" ]] || (echo "xremote: No remote host specified." >&2 && exit 1)
REMOTE_DIR="$(ssh </dev/null "${REMOTE_HOST}" mktemp -d /tmp/xremote.from_"$(hostname)_$(date +%Y%m%d-%H%M%S)".XXXXXX)"
ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ${REMOTE_COMMAND}"
######################################################################
# Disable globbing to keep wildcards for the remote side
ssh </dev/null "${REMOTE_HOST}" "cd \"${REMOTE_DIR}\" && ${REMOTE_COMMAND}"
######################################################################
# Disable globbing to keep wildcards for the remote side