Re: [Bashburn-info] I think I fixed the AUTHOR problem.
Brought to you by:
bashburn
|
From: Anders L. <and...@gm...> - 2008-09-21 22:35:57
|
Yeah thats pretty much what I meant. Telling the shell which characters
are to be used to separate fields.
Question, why are you setting a new IFS and shortly after set it back to
the old IFS in loops?
Is it because programs used in the loop needs the original IFS to work
properly?
On another note, I noticed when starting the latest svn snapshot of BB,
it spits out an error message
that the command die does not exist. I'm guessing because you have not
sourced the needed file yet at that point.
On Sun, 2008-09-21 at 18:20 -0400, Steven W. Orr wrote:
> On Sunday, Sep 21st 2008 at 16:34 -0000, quoth Anders Lind?n:
>
> =>Meh, I sent my reply to Steven and not the list. Reposting it here.
> =>
> =>If I'm not mistaken, IFS is something that is treated as a space or
> =>newline character no? You can set a character like @, : or | in our case
> =>to be treated as a whitespace to separate text fields?
> =>
> =>On Sun, 2008-09-21 at 16:17 -0400, Steven W. Orr wrote:
> =>> It looks like we have three different values that are being used for IFS.
> =>> There's the IFS=: which is needed to read a bbrc file. There's IFS=@ used
> =>> to pass uneval'd data to bbconfmenu. And now there's IFS='|' which is
> =>> needed to store configure_changes. (BTW, the implication is that a config
> =>> val may no longer contain an embedded pipe char.)
> =>>
> =>> Nick, I hope this works. There's always one guy who screws up and makes
> =>> people aware that he's good at testing. I consider it a blessing. ;-) The
> =>> good news is that if you find anything wrong with it, it should be easy to
> =>> fix. (I try to never let people know that I know how to get the printer
> =>> working. ;-)
> =>>
> =>> On a related topic, I was just curious. Do people understand what IFS is
> =>> and what I'm doing with it? How it gets restored? etc...?
>
> Close. IFS is used as the mechanism to tell bash how to parse text. For
> example, if I have
>
> foo='This is a string: It has some stuff in it. And it's 2:00PM.'
> then I can say
> set -- $foo
> After the set command,
> $1 will be 'This'
> $2 will be 'is'
> $3 will be 'a'
> and $4 will be 'string:'
>
> But if I was to say
> IFS=:
> set -- $foo
> then $1 will be 'This is a string'
> $2 will be ' It has some stuff in it. And it's 2'
> and $3 will be '00PM.'
>
> In addition, lists will be taken apart differently (for example is for
> loops, depending on IFS. All the values of IFS that I work with are local
> copies in subroutines. e.g.,
>
> subX()
> {
> typeset old_IFS="$IFS"
> typeset IFS="$old_IFS"
>
> The default value for IFS is whitespace
>
> 533 > echo "$IFS" | od -bc
> 0000000 040 011 012 012
> \t \n \n
> 0000004
>
>
--
Anders Lindén
http://bashburn.sf.net
|