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.

7
  • 5
    I had to move the IFS="" to before the array assignment but this is the correct answer.
    – rob
    Commented Apr 2, 2015 at 7:52
  • I am using several arrays to parse info and I shall have the effect of IFS="" working in only one of them. Once I use IFS="" all other arrays stop parsing accordingly. Any hints about this? Commented Oct 9, 2015 at 14:37
  • Paulo, see another answer here which may be better for your case: stackoverflow.com/a/9089186/1041319. Have not tried IFS="", and seems it does solve it elegantly - but your example shows why one may encounter issues in some cases. It may be possible to set the IFS="" on a single line, but it may still be more confusing than the other solution.
    – arntg
    Commented May 26, 2017 at 18:05
  • It also worked for me on bash. Thanks @Khushneet I was searching it for half an hour... Commented Oct 21, 2017 at 19:42
  • Great, only answer on this page that worked. But I also had to move the IFS="" before the array construction.
    – pkamb
    Commented Oct 24, 2018 at 5:36