Thank you Steve. But unfortunately... That gives me “rc (testread): variable name not singleton!” Trying the read with the -m option gets me the following errors repeated over and over until I escape out. “awk i/o error occurred on /dev/stdin source line number 1 awk: i/o error occurred while closing /dev/stdin source line number 1" From the command line: cat testdata | read Gives me the first line of the file. cat testdata | read -m Puts all lines of the file to stdout. There was a sample script at the bottom of http://doc.cat-v.org/plan_9/4th_edition/papers/rc that I’ve copied below. It creates its own read function. This is for getting text from stdin. But I’m not seeing how it works - or if it is a path to get where I want to go. I tried to copy that read function and put it at the top of my script and the “while(read line) syntax below my other work. When I ran the script it just waits for some input - after which, it runs trough my other lines, not responding to my input file as $1 is defined in the function, and then when it gets to the while, it prompts me again. I tried to cat into the awk ‘{print; exit}’ in the while structure - but that didn’t work either. hmmm…. Mack t=/tmp/holmdel$pid fn read{ $1=‘{awk ’{print;exit}’} } ifs=’ ’ # just a newline fn sigexit sigint sigquit sighup{ rm -f $t exit } cat <<’!’ >$t Allentown ... Holmdel ... West Long Branch ! while(){ lab=‘{fortune $t} echo $lab if(~ $lab Holmdel){ echo You lose. exit } while(read lab; ! grep -i -s $lab $t) echo No such location. if(~ $lab [hH]olmdel){ echo You win. exit } } > On Jan 5, 2019, at 5:45 PM, Steve Simon wrote: > > > try > > cat $1 | while(line=`{read}){ > echo $line > } > > no doubt you cam do without the cat but i am unsure off hand where to put the redirect in and i am not on plan9 just now. > > -Steve > > On 5 Jan 2019, at 10:34 pm, Mack Wallace > wrote: > >> 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 >> >> >>