bug-bash
[Top][All Lists]
Advanced

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

Re: Some Special Array Variables Only Kind Of Initialized


From: Chet Ramey
Subject: Re: Some Special Array Variables Only Kind Of Initialized
Date: Sat, 11 Jan 2014 18:18:09 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 1/11/14, 5:54 PM, John R. Graham wrote:
> On 01/11/2014 04:55 PM, Chet Ramey wrote:
>> On 1/10/14, 6:06 PM, John R. Graham wrote:
>>> Some of the automagically created special array variables (GROUPS and
>>> DIRSTACK for soer; perhaps others) appear to not be fully initialized.
>>> Their values don't appear correctly in some corner cases until they've
>>> been referenced with parameter expansion (I think that's the triggering
>>> criteria, anyway). The following shell dialog illustrates:
>> Yes. There are a number of dynamic variables whose values are generated
>> each time they are referenced.  In most cases, they have no values until
>> the value is generated the first time.
> 
> Thank you. I had determined that it was related to dynamic variables. The
> only code that I've found in Bash that doesn't properly generate the values
> is the dump of all
> variables when the "set" built-in command is called with no arguments.

You don't want the value generated in all cases.  This has an effect on
some variables: RANDOM, for example.  I believe the current behavior is
preferable.

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



reply via email to

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