title: How to prevent Bash's while loop from trimming whitespace?
body: <p>I need to pipe data into a while loop in a bash script, but it keeps trimming the whitespace. For example:</p>
  
  <pre><code>echo "   test" | while read i; do echo "$i"; done
  </code></pre>
  
  <p>How can I prevent it from doing this?</p>
  
  <p>Thanks!</p>