From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by hawkwind.utcs.toronto.edu via suspension id <2701>; Fri, 24 Sep 1993 18:00:12 -0400 Received: from relay1.UU.NET ([192.48.96.5]) by hawkwind.utcs.toronto.edu with SMTP id <2699>; Fri, 24 Sep 1993 17:46:17 -0400 Received: from spool.uu.net (via LOCALHOST) by relay1.UU.NET with SMTP (5.61/UUNET-internet-primary) id AA18512; Fri, 24 Sep 93 17:46:03 -0400 Received: from srg.UUCP by uucp4.uu.net with UUCP/RMAIL (queueing-rmail) id 174456.24956; Fri, 24 Sep 1993 17:44:56 EDT Received: from ceres.srg.af.mil by srg.srg.af.mil id aa01665; Fri, 24 Sep 93 17:19:30 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: Re: forking builtins Date: Fri, 24 Sep 1993 17:19:41 -0400 Message-Id: <9309241719.aa13919@ceres.srg.af.mil> While this discussion about forking builtin's to do redirection is all well and good, it seems like a fairly odd way to use read. As I've said in the past, the reasons you would usually use read are to: 1) Get a single line of input from a user. In this case performance isn't an issue and the user is presumably talking to fd 0 and there's no problem. (There may be a case for using /dev/tty but performance still isn't going to be an issue.) For example: echo -n 'Where do you want logfile written? ' read logfilename 2) Chewing through a whole input stream or datafile. In this case performance is an issue but since the data is presented as a stream presumably on fd 0 and again there's no problem. For example: here = `pwd { find . -type d -print | while (read dirname) { if (cd $here/$dirname) ls -l >.contents }} I can only think of one case where you might do something like (get only the first line of a file): read bgcolor <.background and in that case you'd be crazy to do it more than once, so again performance shouldn't be an issue. Tom