I want to test if there is any output from the diff
(test if files are same), if none echo "Passed $x" else echo "Failed $x"
. I came up with some intermidiate step (save the output from diff to a file then read from file)
diff "./helloworld$x.out" "./output/helloworld$x.out" > tmp.txt;
output="`cat tmp.txt`";
if [ "$output" = "" ];
then
echo "Passed $x";
else
echo "Failed $x";
fi;
I'm sure the code can be improved? Main question is: is it possible to save the output from diff
directly into a variable?