From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10630 invoked by alias); 11 Apr 2011 16:20:08 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15954 Received: (qmail 9542 invoked from network); 11 Apr 2011 16:20:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=u6r7uDtL70eNqc1yW3/Q7sZjNhMs4bpdbCAjwvdwMVs=; b=dq6lJokqfVWc14tYmckRlcMeyre6cNTs0BflYWqR7Vb8bsza02kqirVGj3M1KWclY/ +dS3HgdWyodnz4w4gkGz0cgypBQpFbSnTxp5wUtk/Fag6QVFgwl4SiAYbvdBysuVMTQk aC1dqPFw4Jk3HWwkvKPbL5F62yJu5t7uRU57c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; b=fHz8Iv8zis8NogXGBhVq4Hu/Bxch6vNzC0yGHBVnGARSDw+t3+Iy4xk5rOQgBhs59r KQ34EMkGlX3CVrZosIuEN9+HP4In7uRKFphmEOcWBofgf/qT+PxQ58cLmrpJqDHeM7kW dqwjhwaVbxkybLNqnqCHa6bFagYizmcc3i5bQ= MIME-Version: 1.0 From: =?UTF-8?B?SsOpcsOpbWllIFJvcXVldA==?= Date: Mon, 11 Apr 2011 17:52:24 +0200 Message-ID: Subject: $pipestatus and shell functions To: Zsh Users Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello, I'm somewhat confused by the behaviour of the $pipestatus variable: $ true | true ; echo $pipestatus 0 0 $ false | true ; echo $pipestatus 1 0 $ true | false ; echo $pipestatus 0 1 $ false | false ; echo $pipestatus 0 0 $ foo() { true } $ true | foo ; echo $pipestatus 0 0 $ false | foo ; echo $pipestatus 1 0 So far, everything is fine for me, but then: $ foo() { false | true } $ true | foo ; echo $pipestatus 1 0 $ foo() { false | false } $ true | foo ; echo $pipestatus 1 1 $ foo() { true | true | true } $ false | foo ; echo $pipestatus 0 0 0 So $pipestatus is defeated by multiple pipelining=E2=80=A6 Is this by design? If so, is there some not-so-complicated workaround to get the exit code of process A in =E2=80=9C A | B =E2=80=9D for any B (i= e. even if B is itself a shell function with a pipe)? Thanks in advance, best regards, --=20 J=C3=A9r=C3=A9mie