Re: [Bashburn-info] I think I fixed the AUTHOR problem.
Brought to you by:
bashburn
|
From: Steven W. O. <st...@sy...> - 2008-09-21 22:20:22
|
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
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
|