Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14229

Re: Case of set -e not being in effect in a subshell.

Path csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Clark Wang <dearvoid@gmail.com>
Newsgroups gnu.bash.bug
Subject Re: Case of set -e not being in effect in a subshell.
Date Mon, 11 Jun 2018 23:06:02 +0800
Lines 34
Approved bug-bash@gnu.org
Message-ID <mailman.1664.1528729607.1292.bug-bash@gnu.org> (permalink)
References <CAG2j0scsLBhh8b5aB_ORYS+ND0jUWzfnGsE9u3WO4TGHdhc4WQ@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1528729607 32282 208.118.235.17 (11 Jun 2018 15:06:47 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bash.bug list" <bug-bash@gnu.org>
To Bartłomiej Palmowski <rotwang@crux.org.pl>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rCzL3mEzA2V0mT2yjXTbi4uyqFd+PY1js88ZTh40V0w=; b=L4MpOcKd9ijlqrEEuTcVYE3JavFU2xMVpIHnReCq+KiLfJNGmQIkNDDtxW+Xw6tn9U pZtK/bLhm59IPFR9SE0hITixDK1RKs0Z/8pkymiD4GFBfWSpnPW/upFvoWKrVR3lbCM5 n6MlBeUMRqt3qDElyHXMMInzVeIYCQMM40UR8o8TRaZKSWotSsWWD+WdRqcxCRc6mTNF WH/XFqBT+at24laZxOOZVgQTzoSGYjATOWXQlUXw07dYJMcOeCn3yAcokln32LOomvpA xH8Hn5aiTBRJX9xPB7xpXmL2sbsiffrC4klZ8AVECFD2ZqX2hkns+L1VzxvpTljjnz27 ln8w==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rCzL3mEzA2V0mT2yjXTbi4uyqFd+PY1js88ZTh40V0w=; b=rCQTsvrVrrNBXbfTnJDvixT3daKcJa2Jars5F8tnxGYFTHsq8jeGFPyR+P/g/Kg5+p ERIfhPtFOjqljf/i5no1qmpNeTConj7Zawvk+9JyOzzk5cGRly16g+1YVFdY3nTph51s 1exv/AL7t6Am4PAqfWSQDbX1pNhifJIKvV9JbiPA8sq0FNaaMPrB3emKLOQNNPGnyGqZ x1X15AYH7UGLrvwlHlsRT5vZpoZhms5FK28rPrQXR9gl19XNknt5/JDWxEdmubsFOxOb qo3kGGYz87TuEHka/r34XTSSOsiqfDESjFzYLKWRb7It8k1plvm/U5xESy/sqR//DweW eCTw==
X-Gm-Message-State APt69E117eTsDB6QjW98NlQXT+AY+9oCCcenkXPARCn7R8I3lUME2sKT aMpU/iCk9T8mN9JV/rrVluJBr114aIWLeHSSZCrgpvaT
X-Google-Smtp-Source ADUXVKK0kEiTJ8HugcmgwjWcU7Y1kRG2C3lWkyAIDA3VehtdA7h3WgnmYoRJ4oyAqG7nYwdzk8cD46SkJPqeAO3FuaQ=
X-Received by 2002:a24:b611:: with SMTP id g17-v6mr11228778itf.63.1528729602733; Mon, 11 Jun 2018 08:06:42 -0700 (PDT)
In-Reply-To <CAG2j0scsLBhh8b5aB_ORYS+ND0jUWzfnGsE9u3WO4TGHdhc4WQ@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4001:c0b::22e
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14229

Show key headers only | View raw


On Mon, Jun 11, 2018 at 6:12 PM, Bartłomiej Palmowski <rotwang@crux.org.pl>
wrote:

>
> The issue is:
> $ cat bad
> (
>     set -e
>     false
>     echo "Shouldn't happen?"
> ) && :
> $ bash ./bad ; echo $?
> Shouldn't happen?
> 0
> $ cat good
> (
>     set -e
>     false
>     echo "Shouldn't happen?"
> )
> $ bash ./good ; echo $?
> 1
>
> Probably there is something obvious that I'm missing.
>

According to bash man page:

> The shell does not exit if the command that fails is [...] part of any
command executed in a && or || list except the command following the final
&& or ||, [...]

-clark

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Case of set -e not being in effect in a subshell. Clark Wang <dearvoid@gmail.com> - 2018-06-11 23:06 +0800

csiph-web