From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14988 invoked from network); 25 May 1998 10:42:21 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 25 May 1998 10:42:21 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id GAA29346; Mon, 25 May 1998 06:37:40 -0400 (EDT) Resent-Date: Mon, 25 May 1998 06:36:05 -0400 (EDT) Message-ID: <19980525123646.62861@willkuere.informatik.uni-wuerzburg.de> Date: Mon, 25 May 1998 12:36:46 +0200 From: Thomas Koehler To: Matthias Kopfermann Cc: zsh-users@math.gatech.edu Subject: Re: pipelines and && References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Mailer: Mutt 0.88 In-Reply-To: ; from Matthias Kopfermann on Mon, May 25, 1998 at 11:46:00AM +0200 X-Operating-System: Linux willkuere 2.0.32 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by math.gatech.edu id GAA29280 Resent-Message-ID: <"iQYUx1.0.h97.KcKQr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1545 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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