* [9fans] tip'o'day -- hack
@ 2005-04-21 22:42 Tim Newsham
2005-04-21 23:03 ` David Leimbach
2005-04-21 23:07 ` rog
0 siblings, 2 replies; 5+ messages in thread
From: Tim Newsham @ 2005-04-21 22:42 UTC (permalink / raw)
To: 9fans
This one's from Mike Haertel as described in:
http://tinyurl.com/arnnd
Thanks for Andrey for pointing this out. You can establish a two
way pipe to a command in /srv:
$ cmd <[0=1] | echo 0 > /srv/name
and then access /srv/name to communicate with the command. As
an example:
$ mail <[0=1] | echo 0 > /srv/mailcons
$ con -l /srv/mailcons
... connected to mail until ^\ quit ...
$ con -l /srv/mailcons
... connected again ...
will let you detach and re-attach to the pipe to a long-lived
mail command.
Tim Newsham
http://www.lava.net/~newsham/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] tip'o'day -- hack
2005-04-21 22:42 [9fans] tip'o'day -- hack Tim Newsham
@ 2005-04-21 23:03 ` David Leimbach
2005-04-21 23:07 ` rog
1 sibling, 0 replies; 5+ messages in thread
From: David Leimbach @ 2005-04-21 23:03 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
that's just cool
On 4/21/05, Tim Newsham <newsham@lava.net> wrote:
> This one's from Mike Haertel as described in:
>
> http://tinyurl.com/arnnd
>
> Thanks for Andrey for pointing this out. You can establish a two
> way pipe to a command in /srv:
>
> $ cmd <[0=1] | echo 0 > /srv/name
>
> and then access /srv/name to communicate with the command. As
> an example:
>
> $ mail <[0=1] | echo 0 > /srv/mailcons
> $ con -l /srv/mailcons
> ... connected to mail until ^\ quit ...
> $ con -l /srv/mailcons
> ... connected again ...
>
> will let you detach and re-attach to the pipe to a long-lived
> mail command.
>
> Tim Newsham
> http://www.lava.net/~newsham/
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] tip'o'day -- hack
2005-04-21 22:42 [9fans] tip'o'day -- hack Tim Newsham
2005-04-21 23:03 ` David Leimbach
@ 2005-04-21 23:07 ` rog
2005-04-21 23:08 ` Russ Cox
1 sibling, 1 reply; 5+ messages in thread
From: rog @ 2005-04-21 23:07 UTC (permalink / raw)
To: 9fans
that reminds me of a similar little thing:
if you want to pipe into or from a remote command, you can do
something like:
% echo hello |[3=1] cpu -c 'wc < /mnt/term/fd/3 > /mnt/term/fd/1' | tr '0-9' X
X X X
%
(note that you can't use /mnt/term/fd/0 for stdin because that's
exportfs's input - the network connection itself)
[aside: actually, i'm not sure why cpu needs to open /mnt/term/dev/cons; if it
always did something like the above, then cpu would be even more
seamless than it is
as it is, if you don't have a local /dev/cons (e.g. running when from
a cron job) you have to manufacture one.
]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] tip'o'day -- hack
2005-04-21 23:07 ` rog
@ 2005-04-21 23:08 ` Russ Cox
2005-04-21 23:16 ` rog
0 siblings, 1 reply; 5+ messages in thread
From: Russ Cox @ 2005-04-21 23:08 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
you're supposed to use rx for this.
echo hello | rx wc | tr '0-9'
cpu is for interactive sessions, hence the /dev/cons.
if someone wants to update rx to use ssl like cpu does,
please go ahead.
russ
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9fans] tip'o'day -- hack
2005-04-21 23:08 ` Russ Cox
@ 2005-04-21 23:16 ` rog
0 siblings, 0 replies; 5+ messages in thread
From: rog @ 2005-04-21 23:16 UTC (permalink / raw)
To: russcox, 9fans
> you're supposed to use rx for this.
>
> echo hello | rx wc | tr '0-9'
>
> cpu is for interactive sessions, hence the /dev/cons.
it's true that rx does this (and without the 9p overhead too), but you
don't get /mnt/term with rx, and that's sometimes crucial.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-21 23:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-21 22:42 [9fans] tip'o'day -- hack Tim Newsham
2005-04-21 23:03 ` David Leimbach
2005-04-21 23:07 ` rog
2005-04-21 23:08 ` Russ Cox
2005-04-21 23:16 ` rog
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).