Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!ocpt!princeton!phoenix!pfalstad From: pfalstad@phoenix.princeton.edu (Paul Falstad) Newsgroups: comp.unix.shell Subject: Re: co-processes and bash (ksh does it, can bash?) Message-ID: <52206@wookumz.gnu.ai.Princeton.EDU> Date: 27 Jun 91 07:10:42 GMT References: Sender: gnus@idunno.Princeton.EDU Organization: League For Fighting Chartered Accountancy Lines: 18 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