From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay1.UU.NET ([192.48.96.5]) by hawkwind.utcs.toronto.edu with SMTP id <2192>; Mon, 20 Sep 1993 18:18:27 -0400 Received: from spool.uu.net (via LOCALHOST) by relay1.UU.NET with SMTP (5.61/UUNET-internet-primary) id AA05691; Mon, 20 Sep 93 18:18:04 -0400 Received: from srg.UUCP by uucp1.uu.net with UUCP/RMAIL (queueing-rmail) id 181654.10292; Mon, 20 Sep 1993 18:16:54 EDT Received: from ceres.srg.af.mil by srg.srg.af.mil id aa14025; Mon, 20 Sep 93 18:11:50 EDT From: culliton@srg.af.mil (Tom Culliton x2278) X-Mailer: SCO System V Mail (version 3.2) To: rc@hawkwind.utcs.toronto.edu Subject: Thoughts on a builtin read Date: Mon, 20 Sep 1993 18:11:51 -0400 Message-Id: <9309201811.aa08861@ceres.srg.af.mil> After all the recent discussion about builtin read, it is starting to sound like something that will happen, at the very least as a common addon. Given this, it's time to examine the design options and try to come up with something reasonable. After a bit of thought I came up with the following: To keep things in the spirit of rc, simplicity should be our guiding principle. This shapes most of the design decisions discussed below. 1) One string rather than IFS seperation of fields - simplicity - preserves information, such as runs of blanks - field splitting can always be done later with backquote: read x;x=(`{echo -- $x}) 2) Single variable rather than multiple variables - simplicity - you can always split the fields as above and use subscripts 3) Good behaviour on EOF. - return 1 on EOF, 0 otherwise - save any text on the line before EOF 4) Should strip the newline - This makes "read x;echo -- $x" work right. 5) Doesn't honor \ at EOL for continuation - simplicity 6) If interactive and compiled with readline, use that to get input. - consistency Aside from the last item, Alan Watson has already presented what looks like a reasonable implementation way back on May 17th of this year. (It could be packaged a bit better to fit in with the current addon scheme and be easier to install.) The case for a builtin read could be much better evaluated if some folks would try his version and report back on their experiances. Tom PS - with Alan's permission I'll repackage his read routine as a proper patch so it's easier to try. Alan?