Re: Errors are ignored with local variable assignment

2023-01-04 Thread Chet Ramey
On 1/4/23 1:21 AM, Carlos Prieto López wrote: Bash Version: 5.1 Patch Level: 4 Release Status: release Description:     Errors are ignored when a command with error is assigned to a local variable on the same line of declaration. This comes up often; just last month, in fact: https://l

Re: Errors are ignored with local variable assignment

2023-01-04 Thread Greg Wooledge
On Wed, Jan 04, 2023 at 12:21:27AM -0600, Carlos Prieto López wrote: > Description: > Errors are ignored when a command with error is assigned to a local > variable on the same line of declaration. > > f(){ > return 1 > } > > g(){ > local v=`f` > } > g && echo g > the output is 'g', but

Errors are ignored with local variable assignment

2023-01-04 Thread Carlos Prieto López
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux pingu 5.10.0-20-amd64 #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64 GNU/Li