On 1/12/25 4:19 PM, Greg Wooledge wrote:
On Sun, Jan 12, 2025 at 16:10:03 -0500, Chet Ramey wrote:
This is a combination of two rules: characters in IFS are field
terminators, not separators, and when `read' is supplied fewer
variables than fields,

"Any remaining input in the original field being processed shall be
returned to the read utility "unsplit"; that is, unmodified except that any
leading or trailing IFS white space, as defined in 2.6.5 Field Splitting
shall be removed."

Which basically means that the last variable gets everything else on
the line, including non-whitespace IFS characters.

Part of the pitfall is that this isn't always true.

It's true every time there are more fields than variables. This isn't
the case with your example.


In this case, we get the "expected" result:

You just restated the original example while ignoring the part of my
message about looking for additional input after you find a delimiter.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to