GRAPHS=graphs/ SUCC=() FAILED=() while read -r instance opt; do linecount=$(./cmake-build-release/matching $GRAPHS/$instance | wc -l) result=$(($linecount - 1)) if [ "$result" -eq "$opt" ]; then SUCC+=("$instance: $opt") echo "$instance passed" else FAILED+=("$instance: $result/$opt") echo "$instance failed: $result/$opt" fi done < tests.txt echo echo "Success:" printf '%s\n' "${SUCC[@]}" echo echo "Failed:" printf '%s\n' "${FAILED[@]}"