title: Bash Script: For-Loop Over Newline... Syntax Explained?
body: <p>A frequently asked question both on SO and elsewhere is how to use a bash for-loop to go over each line of output. I'm aware of the answer, and I've been happily using the following for years now:</p>
  
  <pre><code>IFS=$'\n'
  </code></pre>
  
  <p>However, I'm slightly perplexed by the syntax used. I've had a good search / Google, but due to the sheer number of symbols which are used / ignored by search engines in the above - I've not found an explanation.</p>
  
  <p>I've also recently spotted this in some output from another script. I was having problems echoing the result from netcat. Upon closer inspection, it turns out that the output from nc was in a similar format:</p>
  
  <pre><code>$'Some_Output_Here\r`
  </code></pre>
  
  <p>I ended up needing to cut off the <code>\r</code>, but wasn't sure of the best way to go about it, I ended up using <code>egrep -o ([0-9|a-Z]*)</code>. Any better ideas?</p>