From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3625 invoked from network); 4 Oct 1999 05:25:14 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Oct 1999 05:25:14 -0000 Received: (qmail 15625 invoked by alias); 4 Oct 1999 05:22:24 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2655 Received: (qmail 15612 invoked from network); 4 Oct 1999 05:22:19 -0000 X-Sent: Sent from X-System: PHRED X-Running: Proudly running Slackware Linux. X-Sendmail: Delivered via Sendmail 8.9.3 Date: Sun, 3 Oct 1999 22:21:16 -0700 (MST) From: Chris Hansen X-Sender: chris@PHRED.dancris.com To: zsh-users@sunsite.auc.dk Subject: Re: coproc tutorial (Re: questions) In-Reply-To: <991004044139.ZM309@candle.brasslantern.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 4 Oct 1999, Bart Schaefer wrote: > On Oct 3, 2:08pm, Chris Hansen wrote: > } Subject: Re: coproc tutorial (Re: questions) > } > } I now understan how to coproc, when is it actually the best way? <> > } > } Is there a way to write to the keyboard of a coprocess? > } If not, how hard would this feature be to add? > > I can't answer that, as I'm completely mystified as to what "the keyboard > of a coprocess" means. A coprocess is a background job; to the extent > that it has "a keyboard" it would be the same one as the shell that had > started it. Can you give an example of what you're trying to accomplish? > Every tty/pty has a keyboard. I don't know if that is true of coprocesses/background processes. What I was trying to do was write a script that would allow me to use all of zsh's command line magic inside of other programs. I had some nice results with bc, because it will take things from standard in. I didn't do near as well with nslookup because it insists on taking commands from the keyboard. I can echo, print and pipe to stdin on the coproc, I can pipe to the screen of the next terminal, but I'm beginning to suspect it can't be done. (which is what you told me in the first place) The code looked something like this: #!/bin/zsh -i coproc /usr/bin/nslookup while true; do TEST=">" NSLOUT=" " while [[ $TEST != $NSLOUT ]] ; do print -n $NSLOUT read -pk NSLOUT done read 'QUERY?>' print -p $QUERY done Thanks Chris