#!/bin/bash correct=true for (( i = 0; i < 3; i++ )); do a=$(( ( RANDOM % 9 ) + 1)) b=$(( ( RANDOM % 9 ) + 1)) program_out=$(./program $a $b) solution_out=$(./solution $a $b) if [ "$program_out" == "$solution_out" ] then echo "PASS " $program_out " equals " $solution_out else echo "FAIL " $program_out " DOES NOT EQUAL " $solution_out correct=false fi done if [ "$correct" = true ] then echo "PASS"; else echo "FAIL"; fi