zsh-users
 help / color / mirror / code / Atom feed
* Re: exit value of intermediate program in pipe
@ 1998-05-05 11:54 Bernd Eggink
  0 siblings, 0 replies; 12+ messages in thread
From: Bernd Eggink @ 1998-05-05 11:54 UTC (permalink / raw)
  To: zsh-users

Date: Tue, 5 May 1998 13:39:33 +0200 (DFT)
From: Bernd Eggink <rz2a022@uni-hamburg.de>
To: zsh-users@math.gatech.edu
Subject: Re: exit value of intermediate program in pipe

On Mon, 4 May 1998, Bart Schaefer wrote:

> On May 4,  2:03pm, Bernd Eggink wrote:
> } Subject: Re: exit value of intermediate program in pipe
> }
> } Bart Schaefer wrote:
> } 
> } > } In ksh, the normal way to kill a coproc is
> } > }
> } > }   exec 3<&p 3<-
> } > 
> } > Anyway, I'm curious about that ksh-ism, because
> } > it closes the coproc's *output*, not it's input 
> } 
> } Huh? Of course it closes it's input; that's what < means! 
> 
> Think about it a moment.  If you do
> 
> 	cat <&p
> 
> what happens?  The input _of cat_ is connected to the _output_ of the
> coproc, right?  So if you do
> 
> 	exec 3<&p
> 
> then what is descriptor 3?  That better be the _output_ of the coproc,
> too, or ksh is doing some pretty funky special casing.
> 
> So perhaps you meant to say
> 
> 	exec 3>&p 3>-

Hm, I admit that I never tried this in zsh... In fact, it works
like this in zsh, but exactly the OTHER way round in ksh. In ksh
3<&p means "duplicate the coproc input to unit 3". IMHO this is
more consistent and intuitive than what zsh does.

After looking into the doc, I even suspect that this may be a bug...
Quoting from chapter 6, "redirection":

  <&p
  >&p   The input/output from/to the coprocess is moved to the 
        standard input/output.

If 'input' corresponds to <&p, this is fact what ksh does and what 
zsh DOESN'T!

Regards,
    Bernd

--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html



^ permalink raw reply	[flat|nested] 12+ messages in thread
* exit value of intermediate program in pipe
@ 1998-05-02 22:24 Steve Talley
  1998-05-03  0:50 ` Sweth Chandramouli
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Steve Talley @ 1998-05-02 22:24 UTC (permalink / raw)
  To: zsh-users

I have a function foo:

foo () {
	/bin/blah | grep -v "foo"
}

I would like this function to exit with the exit value from the
/bin/blah process, but it exits with the exit value from grep instead.

Is there any way to do this?

Steve


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~1998-05-05 12:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-05 11:54 exit value of intermediate program in pipe Bernd Eggink
  -- strict thread matches above, loose matches on Subject: below --
1998-05-02 22:24 Steve Talley
1998-05-03  0:50 ` Sweth Chandramouli
1998-05-03  1:38 ` Timothy J Luoma
1998-05-03  2:08 ` Bart Schaefer
1998-05-03  6:17   ` Sweth Chandramouli
1998-05-03  9:30     ` Bart Schaefer
1998-05-03 22:15       ` Sweth Chandramouli
1998-05-04  1:35         ` Bart Schaefer
1998-05-04  4:54           ` Sweth Chandramouli
1998-05-04  9:43             ` Bernd Eggink
1998-05-04 11:42               ` Bart Schaefer
1998-05-04 12:03                 ` Bernd Eggink
1998-05-04 15:59                   ` Bart Schaefer
1998-05-05 11:39                     ` Bernd Eggink

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).