Re: Question if bug: declaration of an associative array within a functi
From:
Chris F.A. Johnson
Subject:
Re: Question if bug: declaration of an associative array within a function
Date:
Tue, 15 Jun 2010 17:22:22 -0400 (EDT)
User-agent:
Alpine 2.00 (LMD 1167 2008-08-23)
On Tue, 15 Jun 2010, Rainer Rehak wrote:
> Hey there,
> is it a bug, that the declaration of an associative array within a
> function does not survive till after the function, with primitive
> variables on the other hand that concept works well.
It's not a bug. It's an unfortunate side effect from 'declare'
being a duplicate of the (non-standard) typeset builtin.
If would be much more useful (and semantically accurate), if it
just did what its name implies, and left the 'local' builtin for
declaring variable local to a function.
--
Chris F.A. Johnson, <http://cfajohnson.com>
Author:
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)