bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Bartłomiej Palmowski
Subject: Case of set -e not being in effect in a subshell.
Date: Mon, 11 Jun 2018 11:12:30 +0100

$ 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]