On 2022/03/21 05:45, Andreas Luik wrote:
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
myvar[*] = ('', )  element 0 contains an empty string, so not null.

echo "${myvar[@]:+nonnull}"
nunnull -> likewise not OK, because "${myvar[@]}" is null
myvar[@] = ''  (displays all elements, each quoted.  Since
element 1 contains an empty string, it is quoted and isn't null.




Reply via email to