[Top][All Lists]

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

Re: Zero-length indexed arrays

From: Dale R. Worley
Subject: Re: Zero-length indexed arrays
Date: Tue, 21 Dec 2021 22:48:07 -0500

Lawrence Velázquez <vq@larryv.me> writes:
> Did you mean to say that ${#FOO[*]} causes an error?  Because
> ${FOO[*]} does not, a la $*:

The case that matters for me is the Bash that ships with "Oracle Linux".
Which turns out to be version 4.2.46(2) from 2011, which is a lot older
than I would expect.  But it *does* cause an error in that verison:

    $ ( set -u ; FOO=() ; echo "${FOO[@]}" )
    bash: FOO[@]: unbound variable
    $ bash -uc ': "${FOO[*]}"'
    bash: FOO[*]: unbound variable

> Like ${FOO[*]}, ${FOO[@]} and $@ are exempt from ''set -u''.

It looks like that's a change since 4.2.46.  Is there text in the manual
page about that?


reply via email to

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