bug-bash
[Top][All Lists]
Advanced

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

Errors are ignored with local variable assignment


From: Carlos Prieto López
Subject: Errors are ignored with local variable assignment
Date: Wed, 4 Jan 2023 00:21:27 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

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/Linux
Machine Type: x86_64-pc-linux-gnu

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.

Repeat-By:

f(){
return 1
}

g(){
local v=`f`
}

h(){
v=`f`
}

i(){
local v
v=`f`
}

f && echo f
g && echo g
h && echo h
i && echo i

-----

the output is 'g', but I believe there should be no output



reply via email to

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