Re: command substitution is stripping set -e from options
From:
Greg Wooledge
Subject:
Re: command substitution is stripping set -e from options
Date:
Fri, 2 Oct 2015 09:22:21 -0400
User-agent:
Mutt/1.4.2.3i
On Fri, Oct 02, 2015 at 03:53:42PM +0300, Christoph Gysin wrote:
> I'm still curious as to why set -e is stripped in the first place?
Chet can give the definitive answer, but my take is that it's a huge
surprise to someone writing a function independent of the script, or
using a function that was written independently of the script. If the
function does not expect set -e to be in effect (which is not the default,
and is not done in any sane environment, so why would anyone EXPECT it?)
then it may have been written to work in a normal environment, and will
fail in a set -e environment.
I have many examples of commands that surprisingly explode and set your
house on fire when run in a set -e environment, but which work perfectly
well in a regular environment. See http://mywiki.wooledge.org/BashFAQ/105