Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -fdebug-prefix-map=/build/bash-2bxm7h/bash-5.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wall$ uname output: Linux zebulon 4.19.0-11-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 3
Release Status: release

Description:

        I'm not sure this is actually a bug since dash act the same way but it's quite unexpected for the average user and the manual suggests it should not act like this.

The solution may be to improve the manual instead of fixing the software.


Please, consider the 3 next lines

#1

pierre@zebulon: ~ $ (set -e ; echo A ; false ; echo B ) ; echo C.$?
A
C.1

#Works fine

#2

pierre@zebulon: ~ $ (set -e ; echo A ; false ; echo B ) && echo C.$?
A
B
C.0

#Surprising

#3

pierre@zebulon: ~ $ bash -c 'set -e ; echo A ; false ; echo B ' && echo C.$?
A

#This line works like I was expecting for #2




Repeat-By:

already explained in description



Fix:
    no idea.

    If it's not a bug, I think the manual should explain the difference between #2 and #3 in section 3.2.3 and 3.2.4.3




  • use of set... Pierre Colombier via Bug reports for the GNU Bourne Again SHell

Reply via email to