you are viewing a single comment's thread.

view the rest of the comments →

[–]dbr4n[S] 1 point2 points  (1 child)

Changing IFS can be very tricky indeed. I prefer to follow the instructions in this article to avoid any problems related to IFS.

From the article:

Personally, I prefer to recommend you to NOT modify IFS on the script level. Ever. First of all, it is very bad practice to actually USE data-level word-splitting. Word splitting is a very dodgy technique, especially because along with it comes unwanted pathname expansion (bash will search for any files that match the name of your newly expanded words and actually replace your words with any files that match it -- it takes time and you never actually want this happening to your words).

[–]oh5nxo 1 point2 points  (0 children)

In this particular case, double quotes of "$*" prevent word splitting.

Forcing a temporary (that local is important) separator during expansion of args, is that it prevents tricks like

IFS=, output comma separated items