rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: culliton@srg.af.mil (Tom Culliton x2278)
To: rc@hawkwind.utcs.toronto.edu
Subject: Re: forking builtins
Date: Fri, 24 Sep 1993 17:19:41 -0400	[thread overview]
Message-ID: <9309241719.aa13919@ceres.srg.af.mil> (raw)

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.


             reply	other threads:[~1993-09-24 22:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-24 21:19 Tom Culliton x2278 [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-24 16:40 Alan Watson
1993-09-24  0:03 Tom Culliton x2278
1993-09-23 22:02 Paul Haahr
1993-09-23 18:57 Arnold Robbins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9309241719.aa13919@ceres.srg.af.mil \
    --to=culliton@srg.af.mil \
    --cc=rc@hawkwind.utcs.toronto.edu \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).