title: Timeouting a while loop in Linux shell script
body: <p>This works fine (infinite loop):</p>
  
  <pre><code>$ while TRUE; do printf ".";done
  </code></pre>
  
  <p>.............................................................................</p>
  
  <p>I am trying to <strong>timeout</strong> this <code>while loop</code> with the <code>timeout</code> command.
  All these don't work:</p>
  
  <pre><code>$ timeout 5 while TRUE; do printf ".";done
  $ timeout 5 "while TRUE; do printf ".";done"
  $ timeout 5 "while TRUE; do printf \".\";done"
  $ timeout 5 $(while TRUE; do printf ".";done)
  $ timeout 5 $('while TRUE; do printf ".";done')
  </code></pre>
  
  <p>What is the correct way (if it exists)?</p>