On 1/13/25 12:55 AM, Robert Elz wrote:
Date: Sun, 12 Jan 2025 22:39:57 -0500 From: Greg Wooledge <g...@wooledge.org> Message-ID: <20250113033957.gc27...@wooledge.org>| At the risk of going a bit off topic, may I ask *why* the shell does | that? Were there any files or data stream conventions in common use | in the 1970s that would have prompted that design decision? I can't answer that, I'm not even certain whether it was an original Bourne sh mechanism, or first done in some ksh version,
The original Bourne shell never produced null fields -- it always collapsed sequences of IFS characters -- but preserved the non-whitespace delimiter at the end of input. By the time we got to SVR4.2 (the last version I have access to), the behavior of preserving that final delimiter was gone. ksh first introduced the ability to produce null fields with non-whitespace IFS characters, but retained the Bourne shell behavior of collapsing runs of IFS whitespace to a single delimiter. The POSIX behavior is a self-described hybrid of these.
but do remember in both of those, that the implementation target was the pdp-11, with (in many models) just 64KB total address space - the code anddata had to be made to fit.
The Bourne shell, yes. But by the time Korn got to ksh-86, it was the VAX.
Many of the more obscure edge case rules (including this) are quite likely not because anyone set out to produce this particular result, but because the code to do it the way it was done was slightly smaller, and the result was acceptable.
This is certainly true. It's also probably true that no one noticed anything at the time and just ran with it, which made compatibility a future issue. Chet -- ``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/
OpenPGP_signature.asc
Description: OpenPGP digital signature