[Top][All Lists]

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

Re: in bash 4.4.12,want to verify a behavior...

From: Chet Ramey
Subject: Re: in bash 4.4.12,want to verify a behavior...
Date: Mon, 18 Feb 2019 14:49:34 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.0

On 2/18/19 1:44 PM, L A Walsh wrote:
> On 2/17/2019 6:54 PM, Chet Ramey wrote:
>> Not quite. Dynamic variables are only defined to return the correct value
>> when they are referenced. The rest of the time, the values are
>> indeterminate (and possibly stale). The idea is that you can get an element
>> given the right index, or all the elements with the `*' or `@' subscripts.
>> ...
>> `declare -p' just lists variables and any existing values. It doesn't cause
>> values to be generated. `declare -p BASH_ALIASES' counts as asking for the
>> value.
> Thanks for the more thorough explanation. 
> Was wondering if it would be possible (or worth it) on arrays and
> hashes, where the current value isn't shown, if the number of entries
> stored, might be shown?  That way more people might know that the
> declare -p output may only be giving names (and, maybe size) even if
> not enumerated.

If the value shows up as empty, as when the value hasn't yet been
computed, the number of entries is zero.


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

reply via email to

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