Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-musl Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux bc55e8b47896 5.3.0-42-generic #34~18.04.1-Ubuntu SMP Fri Feb 28 13:42:26 UTC 2020 x86_64 Linux Machine Type: x86_64-pc-linux-musl
Bash Version: 5.0 Patch Level: 16 Release Status: release Description: Script has set errexit flag. It runs function. Function declares local variable and set it to output of run subcommand. Subcommand fails. Script does not care and continue execution. When same function sets global variable instead of local one, the script is stopped by errexit flag as expected. Repeat-By: Scripts are attached. Ouputs bash-5.0# ./script-global-variable-ok.sh This message should be printed bash-5.0# ./script-local-variable-bug.sh This message should be printed Script should stop and this message should not be printed Best regards, Krystian Wojtas Sent with [ProtonMail](https://protonmail.com) Secure Email.
script-global-variable-ok.sh
Description: application/shellscript
script-local-variable-bug.sh
Description: application/shellscript