title: Comparing result, input and output of tests in shell
body: <p>Basically what I want to do is write a <strong>shellscript that will run series of test, take in any input (if there is any) and compare the test result with an output.</strong></p>
  
  <p>So my file looks something like this. </p>
  
  <pre><code>#!/bin/sh
  
  # Let's set our working directory
  DIR="./tests"
  
  # And create some variables
  passed=0
  failed=0
  totalamount=0
  returned=0
  
  # Inform the user about start of testing
  echo "========= TESTING INITIALIZED ========="
  
  # Actual testing I'm trying to do
  </code></pre>
  
  <p>So I assume first thing I should do is create a loop that will run through the tests</p>
  
  <pre><code>for file in "./tests/1/*.test do
  </code></pre>
  
  <p>So Now I'm unsure how can I compare the output of my .test file with a prepared .output program.</p>
  
  <p>For example, I have a program test1.test, that will calculate 2+3. The result is 5. What I want is to have this value stored and compare it with my test1.output</p>
  
  <p>Any idea how to do this? </p>
  
  <p>In the end I'll just compare the two values</p>
  
  <pre><code>if [ $returned -eq $expected ]; then
     echo "Test was succesful"
  else
     echo "Test was unsuccesful"
  fi
  </code></pre>
  
  <p>Basically the end result should look something like:</p>
  
  <pre><code>Test: test1.test  
      Expected result: X  
      Your result: Y  
      Test was succesful/unsuccesful
  </code></pre>