I'm learning bash scripting right now.
I was reading this thread: How to loop over the lines of a file?
What is IFS?
With for and IFS:
BTW, from the answer you posted second solution is that recommended...
As @jasonwryan noticed it's not
When you have an unprotected variable substitution
For loops, like many other contexts, expect a list of words. So
IFS The Internal Field Separator that is used for word splitting after expansion and to split lines into words with the read builtin command. The default value is "<space><tab><newline>".
This is one of Bash's internal variables. It determines how Bash recognizes fields, or word boundaries, when it interprets character strings.
While it defaults to whitespace (space, tab, and newline), it may be changed, for example, to parse a comma-separated data file.