From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from news.lsuc.on.ca ([142.57.1.101]) by archone.tamu.edu with SMTP id <18993>; Tue, 10 Dec 1991 22:16:58 -0600 Received: by news.lsuc.on.ca (/\==/\ Smail3.1.24.1 #24.4) id ; Tue, 10 Dec 91 22:56 EST Received: by golem.uucp (/\==/\ Smail3.1.24.1 #24.13) id ; Tue, 10 Dec 1991 22:53 -0500 To: The rc user community Subject: A lighter read function Date: Tue, 10 Dec 1991 21:53:02 -0600 Message-ID: <21843.692423582@golem.UUCP> From: "David J. Fiander" Having seen, and been shocked at, the read example that comes with the rc sources, I decided to try to write one that doesn't require all of awk to run. The following function provides exactly the same functionality as the example source, except it uses line(1) and doesn't do the assignment if the read fails. nl=' ' fn read { x=() ifs=$nl { x = `{line || echo 1^$nl^1; echo 0} if (~ $x(2) 0) $1 = $x(1) return $x(2) } } -- David J. Fiander |email [Fr., = enamel] Used attrib. in `email ink', ink |used on glass, porcelain, etc.