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: Chet Ramey
Subject: Re: memory management of all_visible_functions return
Date: Thu, 21 Apr 2022 10:06:09 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

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.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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