From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27657 invoked by alias); 14 May 2014 14:32:03 -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: 18802 Received: (qmail 27730 invoked from network); 14 May 2014 14:31:59 -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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 14 May 2014 16:31:55 +0200 From: Florian Lindner To: Peter Stephenson Cc: zsh-users@zsh.org Subject: Re: Stop script if one command returns =?UTF-8?Q?!=3D=20=30?= In-Reply-To: <20140514152011.7a811dcb@pwslap01u.europe.root.pri> References: <20140514152011.7a811dcb@pwslap01u.europe.root.pri> Message-ID: <891422cb1f2a28c07029a09041a120da@xgm.de> X-Sender: mailinglists@xgm.de User-Agent: Roundcube Webmail/1.0.1 Am 14.05.2014 16:20, schrieb Peter Stephenson: > On Wed, 14 May 2014 16:01:19 +0200 > Florian Lindner wrote: >> I have a script that I source with a number of commands and exports. >> Is >> there a way to tell zsh (or even in a portable way to sh) to stop >> execution of this script if any of the commands returns a return code >> other than zero? > > (Count the responses. I'm guessing 3 to 5...) :-P > set -e > > is standard across Bourne-like shells including zsh --- this is > equivalent to the zsh option "ERREXIT". Problem is that set -e or ERREXIT kill my shell when called in a sourced script. Regards, Florian