zsh-users
 help / color / mirror / code / Atom feed
From: Chris Hansen <chris@phred.mine.nu>
To: zsh-users@sunsite.auc.dk
Subject: Re: coproc tutorial (Re: questions)
Date: Sun, 3 Oct 1999 22:21:16 -0700 (MST)	[thread overview]
Message-ID: <Pine.LNX.4.10.9910032146490.11619-100000@PHRED.dancris.com> (raw)
In-Reply-To: <991004044139.ZM309@candle.brasslantern.com>



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?

<<SNIP>>

> }
> } 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



  reply	other threads:[~1999-10-04  5:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-03  8:30 questions Chris Hansen
1999-10-03 11:10 ` questions Stefan Berglund
1999-10-03 17:18   ` questions Bart Schaefer
1999-10-03 18:45   ` coproc tutorial (Re: questions) Bart Schaefer
1999-10-03 21:08     ` Chris Hansen
1999-10-04  2:01     ` coproc Chris Hansen
1999-10-04  4:41       ` coproc tutorial (Re: questions) Bart Schaefer
1999-10-04  5:21         ` Chris Hansen [this message]
1999-10-04  6:22           ` Bart Schaefer
1999-10-04 16:10 Jay Sekora
1999-10-04 18:42 ` Bart Schaefer
1999-10-11 10:45 Sven Wischnowsky
1999-10-11 12:55 ` Thomas Köhler
1999-10-12  6:53 Sven Wischnowsky
1999-10-12  8:42 ` Thomas Köhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.10.9910032146490.11619-100000@PHRED.dancris.com \
    --to=chris@phred.mine.nu \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).