Compare output of program to correct program using bash script, without using text files
- by Doug
I've been trying to compare the output of a program to known correct output by using a bash script without piping the output of the program to a file and then using diff on the output file and a correct output file.
I've tried setting the variables to the output and correct output and I believe it's been successful but I can't get the string comparison to work correctly. I may be wrong about the variable setting so it could be that.
What I've been writing:
TEST=`./convert testdata.txt < somesampledata.txt`
CORRECT="some correct output"
if [ "$TEST"!="$CORRECT" ];
then
echo "failed"
fi