co-processes and bash (ksh does it, can bash?)
Paul Falstad
pfalstad at phoenix.princeton.edu
Thu Jun 27 17:10:42 AEST 1991
larry at 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 at phoenix.princeton.edu | 20 GOTO 10
More information about the Comp.unix.shell
mailing list