bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trailing null fields are discarded while leading ones are preserved


From: Chet Ramey
Subject: Re: Trailing null fields are discarded while leading ones are preserved
Date: Wed, 20 Dec 2006 08:26:20 -0500
User-agent: Thunderbird 1.5.0.8 (Macintosh/20061025)

Stahlman Family wrote:

> Ok. I have found an IEEE interpretation for 1003.2-1992 3.6.5
> (interpretation #98) on the web, and I see that the behavior is correct.
> The thing that wasn't quite clarified by the clarification is the
> question: "If IFS serves only to terminate fields, then how is it that,
> if I add any non IFS character after the final field delimiter, a final
> field is created, which is "delimited" not by anything in IFS, but by
> the end of the original (unsplit) word?" The only satisfactory answer I
> could come up with for this is that the final field in that case is not
> being *created* by word splitting, but merely retained; i.e., the final
> field is all that is left of the original word as it existed prior to
> word splitting. All previous fields were created as a result of
> encountering an IFS delimiter. Thus, the additional fields are sliced
> off the front of the original word, and you are left either with nothing
> (if the final char in the original word was an IFS delimiter) or some
> portion of the original word otherwise. Is this the correct way to look
> at it?

More or less.  Alternately, you can think of the NUL at the end of the
string as an additional field terminator, but one that follows the
adjacency rules and doesn't create any empty fields.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                       Live Strong.  No day but today.
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]