bug-bash
[Top][All Lists]
Advanced

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

Re: parameter expansion null check fails for arrays when [*] or [@] is u


From: Chet Ramey
Subject: Re: parameter expansion null check fails for arrays when [*] or [@] is used
Date: Wed, 23 Mar 2022 10:42:13 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

On 3/21/22 8:45 AM, Andreas Luik wrote:

Bash Version: 4.4
Patch Level: 20
Release Status: release

Description:
        Bash fails to correctly test for parameter to be unset or null when the 
parameter is an array reference [*] or [@].

Repeat-By:

myvar[0]=
echo "${myvar[0]:+nonnull}"
<empty> -> OK
echo "${myvar[*]:+nonnull}"
nunnull -> not OK, because "${myvar[*]}" is null

This was changed in bash-5.0.

echo "${myvar[@]:+nonnull}"
nunnull -> likewise not OK, because "${myvar[@]}" is null

This is still kind of useless, but there are cases where bash doesn't
correctly propagate quoted null strings, and those need to be fixed.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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