#!/bin/bash correct=true program_out=$(./debug_program) solution_out=$(./debug_solution) regex='^\s*42\s*ERROR: File:(.|\s)*$' if [[ $program_out =~ $regex ]] then echo "Pass " else echo "FAIL " $program_out correct = false fi program_out=$(./program) solution_out=$(./solution) regex2='^\s*' if [[ $program_out =~ $regex2 ]] then echo "PASS " else echo "FAIL " $program_out correct=false fi if [ "$correct"==true] then echo "PASS"; else echo "FAIL"; fi