Basically I created a set of tests, that i want to run through, run the test and then compare them with the one's i've got from my before-hand made output files.
So far I've got this
for file in ./tests/*.test; do # Now I'm unsure how can I get the output of a file stored in a variable. # I did this, but I'm unsure whether it's correct ./myexec "$file" returned=$? # So if my understanding is correct, this should run my desired test and store STDOUT # Next I want to compare it to what I have inside my output file compared="$(diff returned ./tests/"$file".output)" if [ -z $compared ]; then echo "Test was successful" passed=$((passed + 1)) else echo "Test was unsuccessful, got $ret but expected ./tests/"$file".output") failed=$((failed + 1)) # I presume that one above is an incorrect way to print out the expected result # But I couldn't really think of anything better.
Either way, this is probably fundamentally wrong on multiple levels, but I'm new to shell so this would be pretty helpful for me to improve my understanding