zsh-users
 help / color / mirror / code / Atom feed
From: Chris Johnson <johnch@uwec.edu>
To: Florian Lindner <mailinglists@xgm.de>
Cc: zsh-users@zsh.org
Subject: Re: Stop script if one command returns != 0
Date: Wed, 14 May 2014 09:19:06 -0500	[thread overview]
Message-ID: <20140514141905.GH13881@vroom> (raw)
In-Reply-To: <a323962f0036f815df308284c22c5710@xgm.de>

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


  reply	other threads:[~2014-05-14 15:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 14:01 Florian Lindner
2014-05-14 14:19 ` Chris Johnson [this message]
2014-05-14 14:20 ` Peter Stephenson
2014-05-14 14:31   ` Florian Lindner
2014-05-14 15:10     ` Bart Schaefer
2014-05-14 16:22   ` Roman Neuhauser
2014-05-14 14:21 ` Florian Lindner
2014-05-14 14:35   ` Peter Stephenson
2014-05-14 14:49     ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140514141905.GH13881@vroom \
    --to=johnch@uwec.edu \
    --cc=mailinglists@xgm.de \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).