As it is not very nice to look at run.out for every output (and it gets overwritten) here is a suggestion for improving output on reg.sh:
checkSuccess() { if [ $1 -ne 0 ]; then echo " ERROR: $2" exit 1 else echo " INFO: $2" fi } checkFailure() { if [ $1 -eq 0 ]; then echo " ERROR: $2" exit 1 else echo " INFO: $2" fi
Example for functions:
echo "Startup" OUTPUTMSG="$(./startup -c 2>&1)" checkSuccess $? "$OUTPUTMSG"
As reg.sh does stop for me after the second test it should be tested if this works correctly.
If this works correctly I can also post a patch to change all functions.
I just added a "cat run.out" on error to the check functions. I think it does the same thing.
I intentionally stop on error.
1 - It's a pass/fail script.
2 - Typically, when it fails, I want to debug from that point. I usually cut and paste the failing line and rerun with -v.
3 - One failure will likely cause failures in subsequent tests. Error handling would be far too complex for this script's purpose.