#!/bin/bash # # Compare result files from testfsa # create output file with differences # and counts the number of lines in output.diff # $1 --> compare from (.result) # $2 --> compare to (.result) if [ "$1" ] && [ "$2" ] then if [ -e "$1" ] then if [ -e "$2" ] then name=$(basename $1 .result) echo "" echo "..Create $name.diff" diff --side-by-side --width=50 $1 $2 | grep "|" > $name.diff echo -n "..Number of differences found: " grep -c "|" $name.diff echo "" else echo "..file $2 not found" fi else echo "..file $1 not found" fi else echo "..Usage: compare [fromfile.result] [tofile.result]" fi