Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: pipelines and &&
- X-seq: zsh-users 1545
- From: Thomas Koehler <thomas@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- To: Matthias Kopfermann <matthi@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: pipelines and &&
- Date: Mon, 25 May 1998 12:36:46 +0200
- Cc: zsh-users@xxxxxxxxxxxxxxx
- In-reply-to: <m0ydtqL-001MsmC@xxxxxxxxxxxxxxxxxxxxxxxxxxx>; from Matthias Kopfermann on Mon, May 25, 1998 at 11:46:00AM +0200
- References: <m0ydtqL-001MsmC@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxx
<>< WWW: http://home.pages.de/~jeanluc/
IRC: jeanluc
LCARS --- Linux for Computers on All Real Starships
Messages sorted by:
Reverse Date,
Date,
Thread,
Author