help-bash
[Top][All Lists]
Advanced

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

Re: Invisible contents of a variable array?


From: Roger
Subject: Re: Invisible contents of a variable array?
Date: Sat, 21 Jan 2023 14:30:32 -0500

Now I understand what was being stated by David.

The real crux or source of the problem was how the initial declaration of
the array was performed.

Now recalling my knowledge of C, really stupid of me for ever typing such a
statement!  As much exercise as I have manually clearing variables memory
prior to usage!

>From another stackoverflow post, the following should clear the array,
similar to using unset.

declare -a _files=()

The real magic here are the "()" parenthesis, acts similar to unset, clears
the variables?  I do not see much within the bash manual concerning "()",
except for functions suffix, etc.

On Sat, Jan 21, 2023 at 8:31 AM Greg Wooledge <greg@wooledge.org> wrote:

> On Sat, Jan 21, 2023 at 03:51:37PM +1100, David wrote:
> > Or, don't even declare the array. Just initialise it:
> >
> > _files=( )
>
> Yes, this is the critical piece.  An empty array is () not "".
>
> If one insists on using declare, it would be:
>
> declare -a _files=()
>
>


reply via email to

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