title: Why is this while loop not looping?
body: <p>I have the following bash script <code>deploy.sh</code>:</p>
  
  <pre><code>#!/usr/bin/env bash
  
  # Some useful resources:
  # while read ip user pass; do : http://unix.stackexchange.com/questions/92664/how-to-deploy-programs-on-multiple-machines
  # -o StrictHostKeyChecking=no: http://askubuntu.com/questions/180860/regarding-host-key-verification-failed
  # -T: http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error
  # echo $pass |: http://stackoverflow.com/questions/11955298/use-sudo-with-password-as-parameter
  
  while read ip user pass; do 
    echo $ip
    sshpass -p "$pass" ssh $user@$ip  -o StrictHostKeyChecking=no -T "
    echo 'yo'
    "
    echo 'done'
  done &lt; servers.txt
  </code></pre>
  
  <p><code>servers.txt</code> contains:</p>
  
  <pre><code>53.12.45.74 my_username my_password
  54.12.45.74 my_username my_password
  57.12.45.74 my_username my_password
  ‌‌ 
  </code></pre>
  
  <p>From my understanding, the <code>while read ip user pass; do […] done &lt; servers.txt</code> should loop over all three lines of <code>servers.txt</code>.</p>
  
  <p>However, when I try to run it, it only performs one iteration:</p>
  
  <pre><code>ubuntu@server:~$ bash deploy.sh
  53.12.45.74
  yo
  done
  ubuntu@server:~$
  </code></pre>
  
  <p>Why?</p>
  
  <hr>
  
  <p>If the loop is simply:</p>
  
  <pre><code>while read ip user pass; do 
        echo $ip
  done &lt; servers.txt
  </code></pre>
  
  <p>it does perform all three iterations:</p>
  
  <pre><code>ubuntu@server:~$ bash deploy.sh
  53.12.45.74
  54.12.45.74
  57.12.45.74
  ubuntu@server:~$
  </code></pre>