Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Christoph Gysin Newsgroups: gnu.bash.bug Subject: Re: command substitution is stripping set -e from options Date: Fri, 2 Oct 2015 15:53:42 +0300 Lines: 23 Approved: bug-bash@gnu.org Message-ID: References: <560D83DA.9020405@redhat.com> <20151002122925.GK25574@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: usenet.stanford.edu 1443791904 14202 208.118.235.17 (2 Oct 2015 13:18:24 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Greg Wooledge Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=bpP41R1mJNgQyFe2pTIpK68qO1wfdYogMKyZ3DhsE2c=; b=sWpQHWmZnjIlzCEYIssrKdNlXsrQqe4C8fmjCoH5N9xUYkDHKUcKWdTlivQ14I4kPv R5g4pUv7zfnlFIsYKD5D9zpP6Z5BZy5YOzHHtW05U6EcT58hjHQ7xGxmaVesQbxulRuS icDwFVBErdOQ7OgGS1sKhoJX7fmdD5dvc28eySMIHi4JHjE7scWQQrrgmWn+vtbFRLAA PbR8cBYMj4dmdiBXo0uNwEoLKnTK1USQ4Ze88WXz56Hw9kgEtikKJVtQe+YUL2VLG3gq F5Mmt+28aBHFSejUspYgrbh44tmkhA9CRAQehCDoEZHWOKvTkyUhD/PwO0SiDltvgGlH lwuw== X-Received: by 10.25.26.71 with SMTP id a68mr3621336lfa.109.1443790462106; Fri, 02 Oct 2015 05:54:22 -0700 (PDT) In-Reply-To: <20151002122925.GK25574@eeg.ccf.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::232 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11575 > Since it's a function, I would recommend return instead of exit. Also, > you don't need the $? there. exit (or return) with no arguments will > retain the exit status of the previous command. Yes, $? is not needed. exit or return is equivalent in this case though because of set -e. > Putting "|| return" or "|| exit" after all critical commands in your > script is precisely what you should do. (Some people write a die() > function and then use "|| die 'my message'" instead.) I consider all commands critical, and if one is allowed to return unsuccessful, I'd rather explicitly allow it with something like: can_fail || : I'm still curious as to why set -e is stripped in the first place? Chris -- echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org@fr33z3