zsh-users
 help / color / mirror / code / Atom feed
* [Q] A mystery (at least for me ...)
@ 1998-12-18  8:44 Didier Verna
  1998-12-18  9:19 ` [1997] " Danek Duvall
  1998-12-18  9:54 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Didier Verna @ 1998-12-18  8:44 UTC (permalink / raw)
  To: Zsh List


	HI!

I have something weird in zsh 3.0.5:

verna(pts/6) 143 % hostname
metheny
verna(pts/6) 144 % if echo toto | grep tata ; then echo SUCCESS ; fi      
zsh: done       echo toto | 
zsh: exit 1     grep tata
verna(pts/6) 145 % if echo toto | grep `hostname` ; then echo SUCCESS ; fi  
SUCCESS
verna(pts/6) 146 % if (echo toto | grep `hostname`) ; then echo SUCCESS ; fi
zsh: exit 1     ( echo toto | grep `hostname` )


	Is it a known bug in this version,or am I missing something ? 

Thanks
-- 
    /     /   _   _       Didier Verna        http://www.inf.enst.fr/~verna/
 - / / - / / /_/ /      E.N.S.T. INF C201.1      mailto:verna@inf.enst.fr
/_/ / /_/ / /__ /        46 rue Barrault        Tel.   (33) 01 45 81 73 46
                      75634 Paris  cedex 13     Fax.   (33) 01 45 81 31 19


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

* Re: [1997] [Q] A mystery (at least for me ...)
  1998-12-18  8:44 [Q] A mystery (at least for me ...) Didier Verna
@ 1998-12-18  9:19 ` Danek Duvall
  1998-12-18  9:22   ` Peter Stephenson
  1998-12-18  9:54 ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: Danek Duvall @ 1998-12-18  9:19 UTC (permalink / raw)
  To: Zsh List

On Fri, Dec 18, 1998 at 09:44:54AM +0100, Didier Verna wrote:

> verna(pts/6) 145 % if echo toto | grep `hostname` ; then echo SUCCESS ; fi  
> SUCCESS
> 
> 	Is it a known bug in this version,or am I missing something ? 

The following commands might explain ...

if echo toto | grep x`false`; then echo SUCCESS; fi

if echo toto | grep x`true`; then echo SUCCESS; fi


The return value of expression "echo toto | grep `cmd`" is the return value
of cmd, not of grep.

I'm not sure how clearly this is documented in the manpage.  At this point,
I've gotten used to the fact that processes act weirdly around pipes, and
I've learned to work around it.

However, documentation on exactly what is expected might be nice.  I
couldn't find it in the section on process substitution or in the section
on pipelines.  Is it somewhere else?

Danek


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

* Re: [1997] [Q] A mystery (at least for me ...)
  1998-12-18  9:19 ` [1997] " Danek Duvall
@ 1998-12-18  9:22   ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1998-12-18  9:22 UTC (permalink / raw)
  To: Zsh List

Danek Duvall wrote:
> On Fri, Dec 18, 1998 at 09:44:54AM +0100, Didier Verna wrote:
> 
> > verna(pts/6) 145 % if echo toto | grep `hostname` ; then echo SUCCESS ; fi 
>  
> > SUCCESS
> > 
> > 	Is it a known bug in this version,or am I missing something ? 
> 
> The return value of expression "echo toto | grep `cmd`" is the return value
> of cmd, not of grep.

[I haven't seen the message this is a reply to here, which is why I'm
replying to this one.]

This is a bug, it's fixed in 3.1.5.  There is a short patch in
zsh-workers message 4397, which you can get from
http://www.zsh.org/mla/ , and which should apply to most versions of
3.x.  You can see the message in
http://www.zsh.org/mla/workers//1998/msg00730.html but you may want to
find a non-html form if you want to apply it automatically.

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

* Re: [Q] A mystery (at least for me ...)
  1998-12-18  8:44 [Q] A mystery (at least for me ...) Didier Verna
  1998-12-18  9:19 ` [1997] " Danek Duvall
@ 1998-12-18  9:54 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 1998-12-18  9:54 UTC (permalink / raw)
  To: Didier Verna, Zsh List

On Dec 18,  9:44am, Didier Verna wrote:
} Subject: [Q] A mystery (at least for me ...)
}
} verna(pts/6) 145 % if echo toto | grep `hostname` ; then echo SUCCESS ; fi  
} SUCCESS
} 
} 	Is it a known bug in this version,or am I missing something ? 

It's a known bug; patch is in zsh-workers article number 4397 (I believe).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~1998-12-18  9:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-18  8:44 [Q] A mystery (at least for me ...) Didier Verna
1998-12-18  9:19 ` [1997] " Danek Duvall
1998-12-18  9:22   ` Peter Stephenson
1998-12-18  9:54 ` Bart Schaefer

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