Hi all

30 students have sent me their answers to me in folders, "name1", "name2", ..., "name30".
Each folder contains 2 outputs, "output_a.txt" and "output_b.txt"
Now I have the correct answer "correct_a.txt" and "correct_b.txt" with me.

I know that using the command diff, I can compare 2 files ::

$ diff correct_a.txt output_a_.txt

But how do I make a shell script that goes inside each folder "namei" (say for the ith student) and compares the outputs "output_a.txt" and "output_b.txt" with the corresponding correct answers "correct_a.txt" and "correct_b.txt"
AND generate a file "scorei.txt" (say, for the ith student) that will tell me which of their answers is correct and which is wrong.

PLEASE HELP ME OUT, SINCE I NEED TO CHECK THEM URGENTLY

regards
Alice

pseudo code

for i ...
do
  cd ${name}${i}
  diff ...
  cd ..
done
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.