On 8/28/24 11:41 PM, Robert Elz wrote:
The reason all this is messy, is that it is (more or less) the way it was implemented in the original Bourne shell. That tells you that the implementation must be simple - the rules might seem complex to explain, but the implementation is sure to be simple, because that shell wasted no code it could avoid.
Mostly. The POSIX splitting algorithm is mostly ksh's, so it modifies some of Bourne's more questionable design choices. The significant ones are that we don't split all words, and multiple consecutive non-whitespace IFS characters can delimit empty fields, where the Bourne shell skips all IFS characters when looking for the next field, whitespace or no. 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