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


Groups > gnu.bash.bug > #14228

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

From Bartłomiej Palmowski <rotwang@crux.org.pl>
Newsgroups gnu.bash.bug
Subject Case of set -e not being in effect in a subshell.
Date 2018-06-11 11:12 +0100
Message-ID <mailman.1661.1528726225.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 18.04 LTS
Release:    18.04
Codename:    bionic

$ apt-cache show bash
Package: bash
Architecture: amd64
Version: 4.4.18-2ubuntu1
Multi-Arch: foreign
Priority: required
Essential: yes
Section: shells
Origin: Ubuntu
[...]

$ which bash
/bin/bash
$ dpkg -S /bin/bash
bash: /bin/bash

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.

cheers,
Bart

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


Thread

Case of set -e not being in effect in a subshell. Bartłomiej Palmowski <rotwang@crux.org.pl> - 2018-06-11 11:12 +0100

csiph-web