rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* optimal scripts
@ 1992-07-09 22:08 Brendan Kehoe
  1992-07-10 15:29 ` Y-shaped pipeline Mark-Jason Dominus
  0 siblings, 1 reply; 2+ messages in thread
From: Brendan Kehoe @ 1992-07-09 22:08 UTC (permalink / raw)
  To: rc mailing list


What's the fastest (most efficient) way to do something like this?

	for (foo in $bar) {
	   if ( some_test $foo ) {
		first=($first $foo);
	   } else {
		second=($second $foo);
	   }
	}

Brendan


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Y-shaped pipeline
  1992-07-09 22:08 optimal scripts Brendan Kehoe
@ 1992-07-10 15:29 ` Mark-Jason Dominus
  0 siblings, 0 replies; 2+ messages in thread
From: Mark-Jason Dominus @ 1992-07-10 15:29 UTC (permalink / raw)
  To: rc mailing list; +Cc: mjd


I have a program, `why', which expects to write output
to file descriptors 4 and 5.  

	why >[4] descriptor-four-log >[5] descriptor-five-log

works fine; the data that `why' writes to desriptor 4 winds up in
`descriptor-four-log', and the data that `why' writes to descriptor 5
goes to the file `descriptor-five-log'.

Now I want the descriptor 4 data to be piped into the stdin of some
command, say `rev', and I want the descriptor 5 data to be piped into
another command, say `cat -n'.  This doesn't work:

	why |[4] rev |[5] cat -n

because that means to connect descriptor 4 of `why' to descriptor 0 of
rev, and then to connect descriptor 5 of rev to descriptor 0 of cat -n.

How can I connect a command to two pipes at once?




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1992-07-10 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-07-09 22:08 optimal scripts Brendan Kehoe
1992-07-10 15:29 ` Y-shaped pipeline Mark-Jason Dominus

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).