Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • "changed within a function - doesn't affect the global". Did you test that? Commented Jun 25, 2012 at 15:11
  • Yes, I've checked that. For the peace of mind, I'll add the unset IFS at the end to reset it to the original, but it worked for me no problem and doing an echo $IFS resulted in the standard output I get from it. Setting the IFS withing the curly brackets introduces a new scope, so unless you export it, it will not affect the outside IFS. Commented Jun 25, 2012 at 16:00
  • echo $IFS doesn't prove anything, because the shell sees the ,, but then does word splitting using IFS! Try echo "$IFS". Commented Jun 25, 2012 at 16:43
  • good point. unsetting IFS should solve that. Commented Jun 25, 2012 at 17:39
  • Unless IFS had a different custom value before calling the function. But yes, most of the time unsetting IFS will work. Commented Jun 25, 2012 at 20:51