#!/bin/bash test=$1 solution=$2 points=0 point=0 numberOfLines=10 ans="" rm -f corrected.txt for((i=1; i<=numberOfLines; i++)) { testLine=$(sed -n ${i}p $test) solLine=$(sed -n ${i}p $solution) if [[ $(echo "$testLine" | grep "$solLine") != "" ]]; then ((points++)) point=1 ans="" else point=0 ans="($solLine)" fi echo $(echo $testLine | sed "s/$solLine/||&||/")" $point/1 $ans" >> corrected.txt } echo "The result: $points/$numberOfLines, "$(($points*100/$numberOfLines))"%" >> corrected.txt echo "The result: "$(($points*100/$numberOfLines))"%"