title: How can I access a file in bash and compare its contents with stdout when running a program to make sure they are identical?
body: <p>How can I to compare the output in stdout of a program with a model output in an output file? I ask because I am trying to make a grading script. Also, I am thinking of using -q grep, but am not sure how I would use it still.</p>
  
  <p>Please make answer simple because I am a noob at bash. </p>
  
  <p>Important edit:</p>
  
  <p>I want to use this in an if statement. For example:</p>
  
  <pre><code>if(modle_file.txt is identical to stdout when running program); then
      echo "Great!"
  else
      echo "Wrong output. You loose 1 point."
  </code></pre>
  
  <p>Edit:</p>
  
  <p>The program takes an input. So for example if we do:</p>
  
  <pre><code>%Python3 Program.py
  Enter a number: 5
  The first 5 (arbitrary) things are:
  2, 5, etc  (program output)
  
  %
  </code></pre>