title: bash while loop iterating 1 extra time
body: <p>I get a file <code>input.txt</code> or URLs by running this in /etc/drush/</p>
  
  <pre><code>ls /etc/drush | grep test  | sed s/.alias.drushrc.php//g | sed '/^$/d' &gt; input.txt
  </code></pre>
  
  <p>I feed that into a loop like this:</p>
  
  <pre><code>while read a; do
      echo "url: $a"
  done &lt; input.txt
  </code></pre>
  
  <p>or like this:</p>
  
  <pre><code>cat input.txt | while read a; do
      echo "url: $a"
  done
  </code></pre>
  
  <p>I always get one extra "url: " at the end, and have verified there is no blank line. I confirmed with</p>
  
  <pre><code>cat input.txt
  </code></pre>
  
  <p>Any ideas what's causing the extra iteration?</p>
  
  <p>input.txt looks like this:</p>
  
  <pre><code>www.first.com
  www.something.com
  www.something.com
  www.last.com
  </code></pre>
  
  <p>output looks like this</p>
  
  <pre><code>url: www.first.com
  url: www.something.com
  url: www.something.com
  url: www.last.com
  url: 
  </code></pre>