title: Bash exit doesn't exit
body: <p>I wonder why this script continues to run even with an explicit exit command.</p>
  
  <p>I have two files:</p>
  
  <p><code>file1.txt</code> with the following content:</p>
  
  <pre>aaaaaa
  bbbbbb
  cccccc
  dddddd
  eeeeee
  ffffff
  gggggg
  </pre>
  
  <p><code>file2.txt</code> with the following content:</p>
  
  <pre>111111
  aaaaaa
  222222
  333333
  ffffff
  444444
  </pre>
  
  <p>The script (<code>test.sh</code>) is this, two nested loops checking if any line of the first file contains any line of the second file. If it finds a match, it aborts.</p>
  
  <pre><code>#!/bin/bash
  path=`dirname $0`
  
  cat $path/file1.txt | while read line
  do  
      echo $line
      cat $RUTA/file2.txt | while read another
      do
          if [ ! -z "`echo $line | grep -i $another`" ]; then
              echo "!!!!!!!!!!"
              exit 0
          fi              
      done
  done 
  </code></pre>
  
  <p>I get the following output even when it should exit after printing the first <code>!!!!!!!!!!</code>:</p>
  
  <pre>aaaaaa
  !!!!!!!!!!
  bbbbbb
  cccccc
  dddddd
  eeeeee
  ffffff
  !!!!!!!!!!
  gggggg
  </pre>
  
  <p><strong>Isn't <code>exit</code> supposed to end the execution of the script altogether?</strong></p>