A bug report from Harald van Dijk:
test2.sh:
trap 'kill $!; exit' TERM
{ kill $$; exec sleep 9; } &
wait $!
The above script ought exit quickly, and not leave a stray
"sleep" child:
(1) if "kill $$" signal is delivered before "wait",
then TERM trap will kill the child, and exit.
(2) if "kill $$"
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -march=native -ggdb -O2 -pipe -Wno-parentheses
-Wno-format-security
uname output: Linux a1i15 4.19.102-gentoo #1 SMP Fri Feb 7 14:32:53 CET 2020
On 2/19/20 7:00 AM, Ulrich Mueller wrote:
> Bash Version: 5.0
> Patch Level: 16
> Release Status: release
>
> Description:
> The GNU Bash Reference Manual Version 5.0 says about test -v:
> '-v VARNAME'
>True if the shell variable VARNAME is set (has been
>assig
> On Wed, 19 Feb 2020, Chet Ramey wrote:
> On 2/19/20 7:00 AM, Ulrich Mueller wrote:
>> Bash Version: 5.0
>> Patch Level: 16
>> Release Status: release
>>
>> Description:
>> The GNU Bash Reference Manual Version 5.0 says about test -v:
>> '-v VARNAME'
>> True if the shell variable VARNAME is
On 19/02/2020 23.18, Ulrich Mueller wrote:
> So, is there any syntax that allows to test if a value has been assigned
> to the array variable? Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?
Not `test` as such as we have just learned, but the returncode of
`declare
On 2/19/20 11:18 AM, Ulrich Mueller wrote:
>> On Wed, 19 Feb 2020, Chet Ramey wrote:
>
>> On 2/19/20 7:00 AM, Ulrich Mueller wrote:
>>> Bash Version: 5.0
>>> Patch Level: 16
>>> Release Status: release
>>>
>>> Description:
>>> The GNU Bash Reference Manual Version 5.0 says about test -v:
>>> '
2020-02-19 17:18:14 +0100, Ulrich Mueller:
[...]
> So, is there any syntax that allows to test if a value has been assigned
> to the array variable? Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?
[...]
You could do:
if typeset -p var 2> /dev/null | grep -q '='; th
On 2/19/20 5:29 AM, Denys Vlasenko wrote:
> A bug report from Harald van Dijk:
>
> test2.sh:
> trap 'kill $!; exit' TERM
> { kill $$; exec sleep 9; } &
> wait $!
>
> The above script ought exit quickly, and not leave a stray
> "sleep" child:
> (1) if "kill $$" signal is delivered before "wait",
>
On Wed, Feb 19, 2020 at 11:38 AM Ulrich Mueller wrote:
> Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?
I'm not sure if it's intended to work this way, but ${var@a} will
report the attributes if the variable has any set, even if it does not
have a value, like:
BASH 5.0.16.
$ VAR1=aaa
$ declare -a VAR2=(aaa)
$ declare -A VAR3=([aaa]=aaa)
$ declare -p VAR{1,2,3}
declare -- VAR1="aaa"
declare -a VAR2=([0]="aaa")
declare -A VAR3=([aaa]="aaa" )
$ echo "${VAR1@A}"
VAR1='aaa'
$ echo "${VAR2@A}"
declare -a VAR2='aaa'
$ echo "${VAR3@A}"
$
--
Arfrever Frehtes T
${!variable@operator} does not work for variables without values.
See empty values for all occurrences of ${!var@...} below.
${variable@A} does not work for scalar variables without values, but
interestingly ${variable[@]@A} works for them.
See difference between ${VAR1@A} and ${VAR1[@]@A} below.
When scalar variable is read-only, then calling 'local' for this
variable (regardless of presence of value in assignment) is non-fatal
and subsequent commands in function are executed.
When (indexed or associative) array is read-only, then calling 'local
-a' or 'local -A' (without value) for this
On 2/19/20 3:05 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> BASH 5.0.16.
>
> $ VAR1=aaa
> $ declare -a VAR2=(aaa)
> $ declare -A VAR3=([aaa]=aaa)
> $ declare -p VAR{1,2,3}
> declare -- VAR1="aaa"
> declare -a VAR2=([0]="aaa")
> declare -A VAR3=([aaa]="aaa" )
> $ echo "${VAR1@A}"
> VAR1='aaa'
Notice unnecessary space before closing parenthesis for non-empty
associative arrays (VAR5, VAR6) below:
$ declare -a VAR1=() VAR2=(a) VAR3=(a b)
$ declare -A VAR4=() VAR5=([0]=a) VAR6=([0]=a [1]=b)
$ declare -p VAR{1,2,3,4,5,6}
declare -a VAR1=()
declare -a VAR2=([0]="a")
declare -a VAR3=([0]="a"
On 2/19/20 3:05 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> BASH 5.0.16.
>
> $ VAR1=aaa
> $ declare -a VAR2=(aaa)
> $ declare -A VAR3=([aaa]=aaa)
> $ declare -p VAR{1,2,3}
> declare -- VAR1="aaa"
> declare -a VAR2=([0]="aaa")
> declare -A VAR3=([aaa]="aaa" )
> $ echo "${VAR1@A}"
> VAR1='aaa'
> ${variable@A} does not work for scalar variables without values, but
> interestingly ${variable[@]@A} works for them.
More precisely, ${variable[@]@A} is non-empty, but not exactly correct.
> See difference between ${VAR1@A} and ${VAR1[@]@A} below.
${VAR1[@]@A} is:
declare -rl VAR1=''"
But sho
While described problems exist, there were typos in original reproduction steps.
Corrected output also reveals another bug:
${!variable[@]@A} for (indexed or associative) arrays does not include indexes.
Example part of output:
var=VAR4
${!var@A}:'declare -arl VAR4='zzz''
${!var[@]@A}: 'declar
On 2/19/20 6:18 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> While described problems exist, there were typos in original reproduction
> steps.
>
> Corrected output also reveals another bug:
> ${!variable[@]@A} for (indexed or associative) arrays does not include
> indexes.
Your examples are
On 19/02/2020 20:30, Chet Ramey wrote:
On 2/19/20 5:29 AM, Denys Vlasenko wrote:
A bug report from Harald van Dijk:
test2.sh:
trap 'kill $!; exit' TERM
{ kill $$; exec sleep 9; } &
wait $!
The above script ought exit quickly, and not leave a stray
"sleep" child:
(1) if "kill $$" signal is deli
Eli Schwartz 2020-02-20 23:49 UTC:
> Your examples are all (still) broken.
This would affect only 10 examples from 120, so only 8.33 % of
examples, far from all examples.
> You cannot use ${!ref[@]}, you need the array subscript as part of the
> set value of "ref" and then indirectly refer to re
Date:Wed, 19 Feb 2020 23:53:56 +
From:Harald van Dijk
Message-ID: <9b9d435b-3d2f-99bd-eb3d-4a676ce89...@gigawatt.nl>
| POSIX says in the description of the trap command "Otherwise, the
| argument action shall be read and executed by the shell when one of the
21 matches
Mail list logo