* Question about redirection
@ 1992-07-15 10:44 malte
1992-07-15 11:00 ` Tim.Goodwin
0 siblings, 1 reply; 6+ messages in thread
From: malte @ 1992-07-15 10:44 UTC (permalink / raw)
To: rc
Could some kind soul explain this to me ?
{ echo stderr >[1=2]; echo stdout } >[2=1] > /dev/null
stderr
{ echo stderr >[1=2]; echo stdout } |[2=1] cat > /dev/null
stdout
<waiting for input>
Malte.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about redirection
1992-07-15 10:44 Question about redirection malte
@ 1992-07-15 11:00 ` Tim.Goodwin
0 siblings, 0 replies; 6+ messages in thread
From: Tim.Goodwin @ 1992-07-15 11:00 UTC (permalink / raw)
To: rc
>Could some kind soul explain this to me ?
> { echo stderr >[1=2]; echo stdout } >[2=1] > /dev/null
> stderr
> { echo stderr >[1=2]; echo stdout } |[2=1] cat > /dev/null
> stdout
> <waiting for input>
Try
{ echo stderr >[1=2]; echo stdout } |[2=0] cat > /dev/null
[ Don't ask how long it took me to realise the mistake :-(. ]
Tim.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about redirection
1992-07-21 0:45 ` John Mackin
@ 1992-07-21 2:06 ` Scott Schwartz
0 siblings, 0 replies; 6+ messages in thread
From: Scott Schwartz @ 1992-07-21 2:06 UTC (permalink / raw)
To: John Mackin; +Cc: The rc Mailing List
The point is that |[m=n] is confusing because it uses '=' in such a
different way than >[m=n]. Wouldn't |[m|n] have been more obvious?
Aside from the deeper semantic issues, it is "m:=n" vs "m->n", but with
the same symbol '=' stuck in the middle. Yes, you can "think about it
the right way", but why should one have to? Grumble, grumble, grumble. :-)
By the way, does anyone miss "if not" (from Tom Duff's rc)? I don't.
Anyone really like overloading static to mean both "own" and
"private"? I don't.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about redirection
1992-07-16 16:18 ` Scott Schwartz
@ 1992-07-21 0:45 ` John Mackin
1992-07-21 2:06 ` Scott Schwartz
0 siblings, 1 reply; 6+ messages in thread
From: John Mackin @ 1992-07-21 0:45 UTC (permalink / raw)
To: The rc Mailing List
The strangeness is that >[n=m] means "the thing on the right reads n
but gets m", while |[n=m] means "the thing on the right reads m but
gets n. Backwards!
Not at all. Or at least I don't think so. All it takes is the right way
of looking at it; I think I have a right way, and I hope it will answer
Malte's question as to how to explain this to an rc novice.
When we write >[2=1], we think of that as "create two by duplicating one",
and view it like an assignment statement (left receives right). When
we write |[2=1], we think "the left process's two gets connected to the
right process's one", and don't use the assignment metaphor.
I think that as long as we think about this in the right way, there
should be no problem.
OK,
John.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about redirection
1992-07-16 10:13 malte
@ 1992-07-16 16:18 ` Scott Schwartz
1992-07-21 0:45 ` John Mackin
0 siblings, 1 reply; 6+ messages in thread
From: Scott Schwartz @ 1992-07-16 16:18 UTC (permalink / raw)
To: malte; +Cc: rc
The strangeness is that >[n=m] means "the thing on the right reads n
but gets m", while |[n=m] means "the thing on the right reads m but
gets n. Backwards! When I first saw |[n=m] I thought m and n should be
swapped so it would work more like >[n=m], or maybe the other way
around.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Question about redirection
@ 1992-07-16 10:13 malte
1992-07-16 16:18 ` Scott Schwartz
0 siblings, 1 reply; 6+ messages in thread
From: malte @ 1992-07-16 10:13 UTC (permalink / raw)
To: rc
I'm sorry for not being precise with my question. What I want to know
is why
{ echo stderr >[1=2]; echo stdout } >[2=1] > /dev/null
and
{ echo stderr >[1=2]; echo stdout } |[2=1] cat > /dev/null
although lexically similar, differ in their semantics, while
{ echo stderr >[1=2]; echo stdout } |[2=1] cat > /dev/null
and
{ echo stderr >[1=2]; echo stdout } >[2] /dev/null
look quite different, but are semantically equal. I became aware of this when
I was asked about something similar by a beginner. I feel it is hard to
explain why >[n=m] differs from |[n=m].
Malte.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1992-07-21 2:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-07-15 10:44 Question about redirection malte
1992-07-15 11:00 ` Tim.Goodwin
1992-07-16 10:13 malte
1992-07-16 16:18 ` Scott Schwartz
1992-07-21 0:45 ` John Mackin
1992-07-21 2:06 ` Scott Schwartz
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).