#!/bin/ksh
# @(#)exitwrapper.sh 1.1 01/08/29  SMI
#
# runs a given commandline and outputs its exit code to
# a file (useful for running inside processes that ignore
# exit codes, such as xterm -e)

cmd="$1"
returnfile="$2"

ksh -c "$cmd"
s=$?
if [ -n "$returnfile" ] ; then
    echo $s > $returnfile
fi
