← Back to team overview

sslug-teknik team mailing list archive

Re: Dagens tricky shell spørgsmål.

 

On Wed, 11 Sep 2002, Mads Bondo Dydensborg wrote:

> > Det hedder coprocesser. ksh og zsh kan det. Jeg har aldrig proevet.
> > Klip fra zsh manpage:
> > 
> >        If a pipeline is preceded by `coproc', it is executed as a
> >        coprocess; a two-way pipe is established  between  it  and
> >        the parent shell.  The shell can read from or write to the
> >        coprocess by means of  the  `>&p'  and  `<&p'  redirection
> >        operators  or  with  `print -p' and `read -p'.  A pipeline
> >        cannot be preceded by both `coproc' and `!'.  If job  con­
> >        trol is active, the coprocess can be treated in other than
> >        input and output as an ordinary background job.
> > 
> > Men jeg kan ikke lige faa det til at virke...
> 
> Hmm. Jeg er ikke sikker på at jeg kan læse det som at det løser mit 
> problem.
> 
> jeg vil have opførsel som:
> 
> ./mit_program > fifo < fifo
> 
> Er det det coproc giver mig?

Som jeg læser det, nej. coproc sætter en pipeline i baggrunden og laver to 
specielle fd'er som er pipelines input og output. Altså:

coproc a | b && cat >&p > <&p

hmmm.

Hvis man kan 
   coproc a | b < >&p

ville det jo virke.

Kan man det?

Mads

-- 
Mads Bondo Dydensborg.                               madsdyd@xxxxxxxxxxxx
Value your freedom, or you will lose it, teaches history. "Don't bother us
with politics," respond those who don't want to learn.

        - Free software proponent, Richard M. Stallman



Follow ups

References