Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2001 00:49:28 +0100
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Changing $IFS in a bash shell
Message-ID:  <20011203004928.D2208@raggedclown.net>
In-Reply-To: <20011202144947.B27117@blossom.cjclark.org>
References:  <3C097584.B51ECEBC@pantherdragon.org> <20011201173255.N13613@blossom.cjclark.org> <ausnaup7da.nau@localhost.localdomain> <3C0AABE1.1DB4F9EC@pantherdragon.org> <20011202144947.B27117@blossom.cjclark.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 02, 2001 at 02:49:47PM -0800, Crist J . Clark wrote:
> On Sun, Dec 02, 2001 at 02:32:01PM -0800, Darren Pilgrim wrote:
> > I solved this one on the command line:
> > 
> > $ IFS="
> > > "
> > 
> > This gives the result I want insofar as how item list word-splitting
> > works now:
> > 
> > $ ls
> > file 1  file 2  file 3  file 4
> > $ for dir in `find * -type f` ; do echo -n "test "; echo ${dir}; done
> > test file 1
> > test file 2
> > test file 3
> > test file 4
> > 
> > Now, how do I do the above in a script?  Like this?
> 
> Actually, after all of this trying to get a newline in IFS, I think,
> 
>   $ IFS=""
> 
> Will work fine for what you want too. Either way, there is no reason
> not to put,
> 
>   IFS="
>   "
> 
This works in bash, honestly, I have written scripts in production use
as we speak that rely on it !

> Or
> 
>   IFS=""
> 
This doesn't work. Well, let me qualify that. It never worked in any
bash script I have been paid to write !

-- 
Regards
Cliff



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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