From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13550 invoked by alias); 10 Jun 2018 13:34:09 -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: List-Unsubscribe: X-Seq: 23462 Received: (qmail 19571 invoked by uid 1010); 10 Jun 2018 13:34:09 -0000 X-Qmail-Scanner-Diagnostics: from spyke.necoro.eu by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(185.11.136.146):SA:0(-1.9/5.0):. Processed in 0.484018 secs); 10 Jun 2018 13:34:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: lists@necoro.eu X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Subject: Re: local/non-local and sub shell exit codes To: zsh-users@zsh.org References: <80a94a63-2862-8ccc-99ca-399dd5def008@necoro.eu> From: =?UTF-8?Q?Ren=c3=a9_Neumann?= Message-ID: <7f581992-e736-a801-9068-58902cba4953@necoro.eu> Date: Sun, 10 Jun 2018 15:34:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <80a94a63-2862-8ccc-99ca-399dd5def008@necoro.eu> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 8bit Ok, I have to take it back. Found the following in the manpage (after discovering, that 'local' is an alias for 'typeset'): ---8<--- Unlike parameter assignment statements, typeset's exit status on an assignment that involves a command substitution does not reflect the exit status of the command substitution. Therefore, to test for an error in a command substitution, separate the declaration of the parameter from its initialization: # WRONG typeset var1=$(exit 1) || echo "Trouble with var1" # RIGHT typeset var1 && var1=$(exit 1) || echo "Trouble with var1" --->8--- - René Am 10.06.2018 um 15:18 schrieb René Neumann: > Hi all, > > I just encountered this strange behavior under zsh-5.5.1: > > % foo=$(false); echo $? > 1 > % local foo=$(false); echo $? > 0 > > Is this intended? As I'm pretty sure that this behavior is new... > > Best regards, > René >