larry@mitra.mitra.com (Larry Williamson) (06/26/91)
Ksh supports the concept of a co-process. You can start a process in the background with it's stdin and stdout connected to the shell. You do this by putting the |& operator after the command. You can then use read -p to read from the co-process and print -p to write to it. I don't see any mention of this nice feature in the BASH documentation. Is there any plan to support this in the future? Is there some other, more general procedure, by which this same feature could be accomplished? -Larry
pfalstad@phoenix.princeton.edu (Paul Falstad) (06/27/91)
larry@mitra.mitra.com (Larry Williamson) wrote: >Ksh supports the concept of a co-process. You can start a process in >the background with it's stdin and stdout connected to the shell. You >do this by putting the |& operator after the command. You can then use >read -p to read from the co-process and print -p to write to it. > >I don't see any mention of this nice feature in the BASH >documentation. Hmm. zsh supports this, using a slightly different syntax. You use the "coproc" keyword instead of |&, and use >&p or <&p instead of -p. I'd probably use process substitution instead, though, to open a pipe to or from a process. The coproc stuff wasn't tested very well because I couldn't really think of a good use for it. -- Paul Falstad | 10 PRINT "PRINCETON CS" pfalstad@phoenix.princeton.edu | 20 GOTO 10