Question on the IFS variable (not a FreeBSD question)
Robert Huff
roberthuff at rcn.com
Sun Aug 12 10:12:31 PDT 2007
Rakhesh Sasidharan writes:
> I understand that the default value of the IFS variable in bash
> is "space, tab, newline".
I believe this to be correct.
> For a script I am playing around with, I want to change IFS to be
> just newline. I tried the obvious like
>
> IFS="\n"
> -or-
> IFS='\n'
>
> but that doesn't seem to do the trick coz then the letter "n"
> ends up being the separator.
>
> A bit of Google searching got me the solution too. That I must set IFS this
> way:
>
> IFS=$'\n'
It is also possible to use:
IFS="
"
with the default shell; this has been (personally) confirmed
within the least few weeks.
Robert Huff
More information about the freebsd-questions
mailing list