sm-sorcery AT lists.ibiblio.org
Subject: Discussion of Sorcery related topics
List archive
- From: Jens Laas <jens.laas AT data.slu.se>
- To: Nick Jennings <nkj AT namodn.com>
- Cc: sm-sorcery AT lists.ibiblio.org
- Subject: Re: [SM-Sorcery]handling of $IFS
- Date: Fri, 18 Oct 2002 08:59:11 +0200 (CEST)
(02.10.17 kl.22:10) Nick Jennings skrev följande till
sm-sorcery AT lists.ibib...:
> On Fri, Oct 18, 2002 at 12:31:03AM -0400, Sergey A. Lipnevich wrote:
> > E.g., consider this pice (takes place in libdepends):
> >
> > save_ifs=$IFS
> > $IFS=$enter_ifs
> > for i in file-with-lines-with-spaces; do
> > $IFS=$save_ifs
> > do stuff
> > done
> > $IFS=$save_ifs
> >
> > Isn't it a bad hack?
> > One thing is clear from your answer: there's no way to reset $IFS to
> > whatever we need and keep it this way. So I'd say we try and find the
> > way to never touch $IFS at all, if at all possible.
> >
>
> I agree, but I think the alternatives are even more gritty...
> At least, the alternatives we've explored.
My experience with IFS has taught me one thing: dont touch it :-)
1.
function func-that-does-stuff {
while read LINE; do
do stuff
done
}
cat file | func-that-does-stuff
2.
cat file |
( while read LINE;
do
echo "Line: $LINE"
done )
Cheers,
Jens Låås
-----------------------------------------------------------------------
'This mail automatically becomes portable when carried.'
-----------------------------------------------------------------------
Jens Låås Email: jens.laas AT data.slu.se
Department of Computer Services, SLU Phone: +46 18 67 35 15
Vindbrovägen 1
P.O. Box 7079
S-750 07 Uppsala
SWEDEN
-----------------------------------------------------------------------
-
[SM-Sorcery]handling of $IFS,
Sergey A Lipnevich, 10/17/2002
-
Re: [SM-Sorcery]handling of $IFS,
Nick Jennings, 10/17/2002
- Re: [SM-Sorcery]handling of $IFS, Sergey A. Lipnevich, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Dufflebunk, 10/17/2002
-
Re: [SM-Sorcery]handling of $IFS,
Sergey A. Lipnevich, 10/18/2002
- Re: [SM-Sorcery]handling of $IFS, Dufflebunk, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Nick Jennings, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Jens Laas, 10/18/2002
- Re: [SM-Sorcery]handling of $IFS, Sergey A Lipnevich, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Jens Laas, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Aaron Brice, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Dufflebunk, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Sergey A Lipnevich, 10/18/2002
- Re: [SM-Sorcery]handling of $IFS, Dufflebunk, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Sergey A Lipnevich, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Dufflebunk, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Sergey A. Lipnevich, 10/18/2002
-
Re: [SM-Sorcery]handling of $IFS,
Nick Jennings, 10/17/2002
Archive powered by MHonArc 2.6.24.