On 2021/12/21 20:07, Greg Wooledge wrote:
On Tue, Dec 21, 2021 at 10:48:07PM -0500, Dale R. Worley wrote:
Lawrence Vel�zquez 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 shi
On 12/22/21 12:12 AM, Lawrence Velázquez wrote:
a. Using ${a[@]} or ${a[*]} with an array without any assigned
elements when the nounset option is enabled no longer throws
an unbound variable error.
https://lists.gnu.org/archive/html/bug-bash/2016-07/msg00031.html
--
On Wed, Dec 22, 2021 at 4:07 AM Greg Wooledge wrote:
> I would recommend not using set -u.
> Especially
> when you need to support multiple bash versions, or even multiple shells.
It's still useful during development stages.
--
konsolebox
On Tue, Dec 21, 2021, at 10:48 PM, Dale R. Worley wrote:
> Lawrence Velázquez 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
On Tue, Dec 21, 2021 at 10:48:07PM -0500, Dale R. Worley wrote:
> Lawrence Velázquez 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 vers
Lawrence Velázquez 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
On Thu, Dec 16, 2021, at 11:45 PM, Lawrence Velázquez wrote:
> Did you mean to say that ${#FOO[*]} causes an error? Because
> ${FOO[*]} does not, à la $*:
>
> [...]
>
> Like ${FOO[*]}, ${FOO[@]} and $@ are exempt from ''set -u''.
Perhaps you're using an old bash, like the one shipped with macOS?
On Thu, Dec 16, 2021, at 11:01 PM, Dale R. Worley wrote:
> A bit ago I was debugging a failing script at work. It turns out that
> when you say
> FOO=(x y z)
> then the variable FOO is an array and is defined. But when you say
> FOO=()
> then the variable FOO is an array (because ${#FOO[*