#!/bin/sh set -eu u="execute COMMAND on HOST, and actually return COMMAND's exit status as our own, as rsh ought to do." eval "$(args rsh-with-status host -r -u "$u" -- "$@")" local_wrapper="$HOME/nightly/share/status-wrapper" tmp_prefix="/tmp/`hostname`-$$" remote_wrapper="${tmp_prefix}.wrapper" remote_status="${tmp_prefix}.status" case "$host" in *"/"* ) echo "first argument should be host, but looks like a filename: $host" exit 1 ;; esac rcp $local_wrapper $host:${remote_wrapper} rsh $host ${remote_wrapper} ${remote_status} "'$*'" status="`rsh $host "cat ${remote_status}; rm ${remote_wrapper} ${remote_status}"`" exit $status