zsh-users
 help / color / mirror / code / Atom feed
From: Thomas Koehler <thomas@wi3d01.informatik.uni-wuerzburg.de>
To: Matthias Kopfermann <matthi@finlandia.Infodrom.North.DE>
Cc: zsh-users@math.gatech.edu
Subject: Re: pipelines and &&
Date: Mon, 25 May 1998 12:36:46 +0200	[thread overview]
Message-ID: <19980525123646.62861@willkuere.informatik.uni-wuerzburg.de> (raw)
In-Reply-To: <m0ydtqL-001MsmC@finlandia.Infodrom.North.DE>; from Matthias Kopfermann on Mon, May 25, 1998 at 11:46:00AM +0200

On Mon, May 25, 1998 at 11:46:00AM +0200, Matthias Kopfermann wrote:

> I would very much like to know how sublists and pipelines are done:
> I read the following without understanding how to do it:
> 
> "If two pipelines are separated by ``&&'', the second
> pipeline is executed only if the first is successful (returns a zero
> value).  If two pipelines are separated by ``||'', the second is
> executed only if the first is unsuccessful (returns a nonzero value).
> Both operators have equal precedence and are left associative."
> 
> now i try something like:
> 	ls | wc && | less  (just to understand the mechanism)
>       
> 		^       ^
> 	There are two pipelines 1) | wc
> 									2) | less
> 	They are separated by &&.
> 		Result: "zsh: parse error near `|'"
> 
> I seem to do it wrong.
> could you give some examples here?

Try something like this:

ls -al | more && cat ~/.zshrc | grep setopt

Now if you're done with pipeline 1 ( ls -al | more ), its exit status
says whether or not to run pipeline 2 (cat ~/.zshrc | grep setopt).
If you kill the "more" process (so it doesn't exit with code 0), the
second pipeline will not be executed.

HTH,
Thomas

-- 
    Thomas Köhler    Email:     jean-luc@picard.franken.de
        <><           WWW:    http://home.pages.de/~jeanluc/
                      IRC:               jeanluc
      LCARS --- Linux for Computers on All Real Starships


  reply	other threads:[~1998-05-25 10:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-25  9:46 Matthias Kopfermann
1998-05-25 10:36 ` Thomas Koehler [this message]
1998-05-26 18:01   ` Matthias Kopfermann
1998-05-26 19:38     ` Bart Schaefer
1998-05-25 16:38 ` Bart Schaefer
1998-05-25 10:46 John Riddoch

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=19980525123646.62861@willkuere.informatik.uni-wuerzburg.de \
    --to=thomas@wi3d01.informatik.uni-wuerzburg.de \
    --cc=matthi@finlandia.Infodrom.North.DE \
    --cc=zsh-users@math.gatech.edu \
    /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).