run-and-check.sh 413 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/sh
# The nextline takes the value in parameter one, evaluates it
# (necessary if it contains spaces) and runs it. > redirects
# stdout to the logfile given in parameter 2.  2>&1 redirects
# stderr to stdout (i.e. to the logfile).
eval $1 > $2 2>&1
RetVal=$?  # captures the return value of the command
if [ $RetVal -ne 0 ]; then
	echo
10
	echo "Please check the logfile" $2 "for errors"
11 12 13
	echo
fi
exit $RetVal