title: Read file line by line through shell script in a Makefile
body: <p>I've got a <code>Makefile</code> with the following script:</p>
  
  <pre><code>target: test.py
      $(PYTHON) test.py
  </code></pre>
  
  <p>The script <code>test.py</code> writes the test results on to a file named as <code>test_result.txt</code> with test statistics, example:</p>
  
  <pre><code>Number of tests:
  Total  : 14
  Passed : 14
  Failed : 0
  </code></pre>
  
  <p>On the call is made to test.py in make, I want to read <code>test_result.txt</code> line by line and echo it. When the line starts with Failed, I wish to read the value and if it is greater than 0 then I return false which would stop the build. </p>
  
  <p>Note: I know to write this in shell script, but when I tried it there were some conflict between the $ symbol of make and shell. Not sure how to resolve it. 
  Couple of example scripts I tried: </p>
  
  <pre><code>1. while read line; do echo -e "$line\n"; done &lt; test_results.txt
  2. cat test/test_results.txt | while read line; echo "$line\n"; done;
  </code></pre>
  
  <p>For both scripts the output was <code>ine</code> for the total number of lines in the file. 
  Though the cat command worked and displayed all the contents in the file.</p>