From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Sat, 5 Jan 2019 16:03:40 -0800 From: Anthony Martin To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Message-ID: <20190106000340.GB21088@alice> References: <6A2B4894-94A0-430A-9A17-84A37F1B4BD6@mapinternet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6A2B4894-94A0-430A-9A17-84A37F1B4BD6@mapinternet.com> Subject: Re: [9fans] How does one read a file line by line in an rc script? Topicbox-Message-UUID: f2ae0fc2-ead9-11e9-9d60-3106f5b1d025 Mack Wallace once said: > Another, probably more stupid question - How does one read a text file > line by line in an rc script. You should really read the rc(1) man page. It will answer your questions. Here the functions foo and bar are equivalent: fn foo { <$1 while(l = `{read}) echo $l } fn bar { { while(l = `{read}) echo $l } <$1 } Think about why this one is not like the others: fn baz { while(l = `{read}){ echo $l } <$1 } Cheers, Anthony