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