Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2007 13:12:29 -0400
From:      Robert Huff <roberthuff@rcn.com>
To:        freebsd-questions@freebsd.org
Subject:   Question on the IFS variable (not a FreeBSD question)
Message-ID:  <18111.16253.130080.423918@jerusalem.litteratus.org>
In-Reply-To: <20070812195535.V86618@obelix.home.rakhesh.com>
References:  <20070812195535.V86618@obelix.home.rakhesh.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18111.16253.130080.423918>