#!/bin/sh set +e set -u [ $# -ge 2 ] || { echo "usage: status-wrapper FILE COMMAND ...">&2 echo "execute COMMAND, and write its exit status to FILE." echo "This is necessary because 'rsh' doesn't propagate the status" echo "returned by the remote command back to its caller." exit 1 } file="$1"; shift eval "$@" echo "$?" > $file