Question on the IFS variable (not a FreeBSD question)
rakhesh at rakhesh.com
Sun Aug 12 08:58:07 PDT 2007
This isn't really a FreeBSD question. But I figure most people on this list
would know the answer and so I'm asking. I've tried to get the answer out of
Google, but I guess I am not asking it the right question and so not
getting much hits.
I understand that the default value of the IFS variable in bash is "space, tab,
newline". For a script I am playing around with, I want to change IFS to be
just newline. I tried the obvious like
but that doesn't seem to do the trick coz then the letter "n" ends up being the
A bit of Google searching got me the solution too. That I must set IFS this
I did that, and sure enough things work the way I want!
So my question is this: how come things work when I set IFS to $'\n' instead of
just plain '\n'? I don't recollect seeing such a way of setting variables
before, and so I'm curious about it.
More information about the freebsd-questions