Here's an ashirazi answer option that doesn't rely on $IFS . He has his own problems, which I will discuss below.
sentence="one;two;three" sentence=${sentence//;/$'\n'} # change the semicolons to white space for word in $sentence do echo "$word" done
I used a new line here, but you can use the " \t " tab or the space bar. However, if any of these characters is in the text, it will also be split. What is the advantage of $IFS - it can not only enable the delimiter, but also disable the standard ones. Just make sure you save its value before changing it, as others suggested.
Dennis Williamson Sep 10 '09 at 19:25 2009-09-10 19:25
source share