From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18268 invoked by alias); 14 May 2014 15:07:41 -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: 18805 Received: (qmail 27928 invoked from network); 14 May 2014 15:07:36 -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 autolearn=ham version=3.3.2 Date: Wed, 14 May 2014 09:19:06 -0500 From: Chris Johnson To: Florian Lindner Cc: zsh-users@zsh.org Subject: Re: Stop script if one command returns != 0 Message-ID: <20140514141905.GH13881@vroom> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginalArrivalTime: 14 May 2014 14:19:00.0510 (UTC) FILETIME=[736D33E0:01CF6F7F] Florian Lindner sent me the following 0.2K: > 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? Setting the ERR_EXIT option will cause the script to bail: setopt ERR_EXIT ls "file does not exist" echo "this won't appear" -- Chris Johnson johnch@uwec.edu