title: Bash read line stops in the middle of the file
body: <p>I've created a bash script to connect to a number of servers and execute a program. The ips and quantities per IP should be read from a config file that is structured like this:</p>
  <pre><code>127.0.0.1 10
  127.0.0.1 1
  127.0.0.1 3
  </code></pre>
  <p>etc</p>
  <pre><code>j=$((0))
  while IFS=' ' read -r ip quantity; do
    echo &quot;${ip} x ${quantity}&quot;;
  
    for (( i = 1; i &lt;= quantity; i++ ))
    do
      echo &quot;ssh root@${ip} cd test/libhotstuff &amp;&amp; ./examples/hotstuff-app --conf ./hotstuff.gen-sec${j}.conf &gt; log${j} 2&gt;&amp;1&quot;
      ssh root@&quot;${ip}&quot; &quot;cd test/libhotstuff &amp;&amp; ./examples/hotstuff-app --conf ./hotstuff.gen-sec${j}.conf &gt; log${j} 2&gt;&amp;1&quot; &amp;
      j=$((j+1))
    done
  
    sleep 1
  
  done &lt; ips
  </code></pre>
  <p>I noticed that this while loop breaks if the execution takes too long. If I put sleep for 1s here it will stop after the first execution. If I remove it, but the inner loop takes too long a subset of the lines will not be read.</p>
  <p>What is the problem here?</p>