# Note that the first failure point may be after running thousands of runs. success=0 failures=0 for run in {1..10000} do mpiexec -np 2 ./moabDemo.exe &> test.txt if grep "YOUR APPLICATION TERMINATED WITH THE EXIT STRING" test.txt then failures=$((failures+1)) tail -n 20 test.txt break else success=$((success+1)) fi echo "Run $run Success: $success Failure: $failures" done