#!/bin/bash i=0 while [ 1 ] do ./mprotect04 if [ $? -ne 0 ]; then echo "i=$i, failed" exit 1 fi i=$(($i+1)) done