9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] How does one read a file line by line in an rc script?
@ 2019-01-05 22:34 Mack Wallace
  2019-01-05 22:45 ` Steve Simon
  2019-01-06  0:03 ` Anthony Martin
  0 siblings, 2 replies; 6+ messages in thread
From: Mack Wallace @ 2019-01-05 22:34 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

Another, probably more stupid question - How does one read a text file line by line in an rc script.

In bash this works:

#!/bin/bash  

while read line  
do  
echo $line  
done < $1 

I’ve tried:

#!/bin/rc  

while (line=`{read $1})  
{
echo $line  
} 

Which produces the first line of the file in an infinite loop. I’ve tried the -m argument with no output.


It’s probably simple, but just can’t seem to find the equivalent.

Regards,

Mack




[-- Attachment #2: Type: text/html, Size: 2716 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-06  0:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-05 22:34 [9fans] How does one read a file line by line in an rc script? Mack Wallace
2019-01-05 22:45 ` Steve Simon
2019-01-05 23:28   ` Mack Wallace
2019-01-05 23:46     ` Steve Simon
2019-01-06  0:33       ` Mack Wallace
2019-01-06  0:03 ` Anthony Martin

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