[Top][All Lists]

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

Re: Does declaring an array variable initialize it?

From: Richard Tollerton
Subject: Re: Does declaring an array variable initialize it?
Date: Thu, 20 Mar 2014 11:28:17 -0500
User-agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu)

Chet Ramey <address@hidden> writes:

> On 3/20/14 12:41 AM, Richard Tollerton wrote:
>> I suppose that this change in behavior makes array variables more
>> consistent with normal variables, but I couldn't find anything in
>> CHANGES which obviously relates to this, so I'm not sure if this is a
>> bug or not.
> There is this, in the list of changes in bash-4.3-beta:
> f.  Fixed several cases where `invisible' variables (variables with attributes
>     but no values, which are technically unset) were treated
>     incorrectly.


>> Was I always mistaken in figuring that declaring an array also
>> initialized it?
> A variable is not set until it has been assigned a value.  This was always
> true, and always supposed to apply to array variables as it did to scalars.
> bash-4.2 had a number of inconsistencies here, and I fixed some number of
> those.  I'm sure some still remain.
> This topic has come up several times in the past, most recently a couple
> of weeks ago:
> http://lists.gnu.org/archive/html/bug-bash/2013-01/msg00068.html
> http://lists.gnu.org/archive/html/bug-bash/2013-11/msg00000.html
> http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00052.html

Understood. Looks like I have some more (worthwhile) reading to do.


> Chet
> -- 
> ``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/

Richard Tollerton <address@hidden>

reply via email to

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