From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9780 invoked by alias); 12 Oct 2012 12:00:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30728 Received: (qmail 20654 invoked from network); 12 Oct 2012 12:00:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 209.85.219.43 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=nblLxFT4muyrK+Qqz2JUDMaETCtipri9FsYATsMxSmo=; b=GZgfABUzQJrSO6vE12h3yPTmtgDMMM0ekzqWIOnqBaVQA210sCwl1MZJDt13+jq513 7NSk+DCDOQ78J0f8pwG9oj+mi3cp81YOgkMPeffmurFQ6R9mj2FQ2ohRoOsjNosU+qkr oVOc/8gaXr2EL8p99AKN2Pg0mfRx6tJquial+q04oYlmIZAO1cP4tK2w1iV/mOsXUuLn jxMoZfbcKukyb7H4nXvvVnHL8SkLwd/B5LF7Hzols49YhSjPH+9I07xw1kLCm+FYz+cv H3f6wQSUKNRDUeaU/rwQJWTQ80Jk8artweHlR73qaahR9Z0TW82r9RSDbEw89lurnKO3 lz/w== MIME-Version: 1.0 X-Originating-IP: [80.239.194.50] In-Reply-To: <20121012110542.314890@gmx.com> References: <20121012110542.314890@gmx.com> Date: Fri, 12 Oct 2012 12:53:35 +0100 Message-ID: Subject: Re: set -e (no && or ||) From: Peter Stephenson To: zsh-workers@zsh.org Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQk8d4Qyz/lGDHl/OTt7PhHdB4ebPFokiyVrPYFqqEhpz0n9ytlISI4PkumgNfqyadCCfAXO On Fri, 12 Oct 2012 07:05:41 -0400 Sergey Fadeev wrote: > Why doesn't it exit the shell? > $ set -e > $ echo $(false) > Shouldn't the error code of $(false) command substitution be checked > by set -e before passing stdout to the echo builtin? No, because the command was "echo", and that didn't fail. Exit status effectively means exit status seen by the main shell command interpreter ($?), although I'm sure there are some subtleties I haven't thought about. The way to get the status of a substitution to fail is to use an assignment: output=$(false) which does cause the shell to exit on failure, because it would set $? to 1. This is standard shell behaviour, though I can't point to where in the standard it says. pws