Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [1997] [Q] A mystery (at least for me ...)



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



Messages sorted by: Reverse Date, Date, Thread, Author