Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2001 01:15:43 +0100
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Changing $IFS in a bash shell
Message-ID:  <20011203011543.A8286@raggedclown.net>
In-Reply-To: <3C0AC0D9.BFD0604B@pantherdragon.org>
References:  <200112022343.fB2Nh6k27466@c1742628-a.vncvr1.wa.home.com> <3C0AC0D9.BFD0604B@pantherdragon.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 02, 2001 at 04:01:29PM -0800, Darren Pilgrim wrote:
> chk no wrote:
> > Changing IFS is usually not the best way to do things.  Changing IFS
> > can break other scripts, other parts of your script, & is generally
> > only used as a last resort.
> 
I disagree.
You can save and restore the IFS if you are worried about it.
But the IFS is only changed in the script itself (as long as you
don't source it, but that is not a likely scenario here).

> How else do you recommend I alter the criteria bash uses for its
> word-splitting routine?
> 
> Redefining IFS in a script isn't a problem at all.  The value will only
> last for duration of the script, inside that script only.
> 
> > Instead, try things like:
> > 
> > eval ... |sed "{

More processes, more things to go wrong, more vulnerability to malformed
data.

> <snip>
> 
> I'm doing it with a for-in-do loop to avoid having to use external
> programs.  This is going to be part of a web-front end for a file
> archive, and the fewer external programs the scripts have to call the
> better.
> 
Precisely.
What you are doing is the correct way to do it IMHO.

-- 
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?20011203011543.A8286>