help-bash
[Top][All Lists]
Advanced

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

Re: memory management of all_visible_functions return


From: Robert E. Griffith
Subject: Re: memory management of all_visible_functions return
Date: Thu, 21 Apr 2022 11:10:26 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

Well that worked out! I did not even realize they were connected but the bug I was just struggling with turned out to be that the variable my builtin was filling in was invisible so back in the bash script, "${!Array_vmt[@]}" was returning nothing even though there were elements.

So now the builtin does VUNSETATTR (vVMT, att_invisible); on all the variables it fills in and all is good:)

--BobG

On 4/21/22 10:06, Chet Ramey wrote:
On 4/20/22 3:52 PM, Robert E. Griffith wrote:

`Invisible' variables are variables that have been assigned attributes but
not values, so they are technically unset.

So what is the practical consequence of them not being visible?

The variable shows as unset when referenced.

Local variables have their own scoping issues that complicate things on
occasion, but it's easy to see with something like this:

myvar="hello"
foo()
{
   local myvar
   local b=isset

   echo "${myvar-unset}"
   echo "${b-unset}"
}
foo

You'll get

unset
isset

as output because `myvar' is unset.





reply via email to

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