rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re:  builtin read
@ 1993-09-17 13:54 gjv%atlas%cesar
  0 siblings, 0 replies; only message in thread
From: gjv%atlas%cesar @ 1993-09-17 13:54 UTC (permalink / raw)
  To: rc%hawkwind.utcs.toronto.edu%m_internet%m_mailnow%hermes.DECnet

 |I have not decided yet wether a builtin read is a good idea or not.
 |Meanwhile let me help you with this
 |    for( line in `` ($nl) { cat /some/file }){
 |        words = `{ echo $line }
 |    }

Agreed, it looks better than what I came up with, but my objections
remain the same. You still need to fork&exec a cat, and it remains
a bit cludgy IMHO.

 |But I don't understand how your second solution works because there
 |must be something wrong with input redirection. My rc behaves like this:
 |	; while( echo outside ){ echo inside } > /dev/null
 |	outside
 |	outside
 |	..

Oops, typo in my mail I guess, forgot the accolades around the whole
while+body. Applying it to your example, it becomes

	; { while (echo outside) {echo inside}  } > /dev/null

which works as I intended.

I'm not yet convinced though, a builtin read makes the shell more complete
IMHO, not to mention that it would make it easier to pass scripts around.
If someone else wants to use a script of mine, who guarantees that he/she
has an identical read function in his environment, and in case I add a
read function to my script, should I use awk, "sh -c 'read a;echo $a'",
/usr/bin/line, ... ????  And I think that performance is a reasonable
argument here as well.


J.G. Vons   E-Mail: vons@cesar.crbca1.sinet.slb.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1993-09-17 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-09-17 13:54 builtin read gjv%atlas%cesar

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).