#!/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 " echo $program_out else echo "FAIL " echo $program_out correct=false fi done echo "" if [ "$correct" = true ] then echo "PASS"; else echo "FAIL"; fi