* Translating question
@ 1993-12-09 0:20 Tom Culliton x2278
1993-12-09 1:36 ` Scott Merrilees
0 siblings, 1 reply; 3+ messages in thread
From: Tom Culliton x2278 @ 1993-12-09 0:20 UTC (permalink / raw)
To: rc
The following fragment was easy to prototype in rc:
prog1 |[3] prog2 # output of fd 3 is piped to stdin
but trying to convert it to Bourne shell is making me nuts! I want
stdout and stderr to go to "the usual place" with just "special stuff"
being piped into the second program. Could someone give me a clue
before I have to embarrass myself in comp.unix.shell?
Thanks!
Tom (with yet another reason too love rc and hate the rest)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Translating question
1993-12-09 0:20 Translating question Tom Culliton x2278
@ 1993-12-09 1:36 ` Scott Merrilees
1993-12-09 1:47 ` Scott Merrilees
0 siblings, 1 reply; 3+ messages in thread
From: Scott Merrilees @ 1993-12-09 1:36 UTC (permalink / raw)
To: rc
>The following fragment was easy to prototype in rc:
>
> prog1 |[3] prog2 # output of fd 3 is piped to stdin
>
>but trying to convert it to Bourne shell is making me nuts! I want
>stdout and stderr to go to "the usual place" with just "special stuff"
>being piped into the second program. Could someone give me a clue
>before I have to embarrass myself in comp.unix.shell?
This is probably not optimal, but it seems to work:
(exec 4>&1;((echo a; echo b>&2; echo c>&3))>&4 3>&1 | cat > 1); cat 1; rm 1
so you could probably use:
(exec 4>&1;prog2 >&4 3>&1 | prog2)
Sm
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Translating question
1993-12-09 1:36 ` Scott Merrilees
@ 1993-12-09 1:47 ` Scott Merrilees
0 siblings, 0 replies; 3+ messages in thread
From: Scott Merrilees @ 1993-12-09 1:47 UTC (permalink / raw)
To: rc
I knew I should have tested that final optimization!
Instead, use:
(exec 4>&1;(((echo a; echo b>&2; echo c>&3))>&4) 3>&1 | cat > 1); cat 1; rm 1
# ^ note extra paranthesis! ^
so you could probably use:
(exec 4>&1;(prog2 >&4) 3>&1 | prog2)
# ^ ^
Sm
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-12-09 1:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-12-09 0:20 Translating question Tom Culliton x2278
1993-12-09 1:36 ` Scott Merrilees
1993-12-09 1:47 ` Scott Merrilees
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).