From: Anthony Martin <ality@pbrane.org>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] How does one read a file line by line in an rc script?
Date: Sat, 5 Jan 2019 16:03:40 -0800 [thread overview]
Message-ID: <20190106000340.GB21088@alice> (raw)
In-Reply-To: <6A2B4894-94A0-430A-9A17-84A37F1B4BD6@mapinternet.com>
Mack Wallace <mackbw@mapinternet.com> 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
prev parent reply other threads:[~2019-01-06 0:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-05 22:34 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 message]
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190106000340.GB21088@alice \
--to=ality@pbrane.org \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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).