From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1364 invoked by alias); 30 Jun 2016 17:04:59 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21715 Received: (qmail 12161 invoked from network); 30 Jun 2016 17:04:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=95RwYl3rqqVcTvULnrHvoQvNoIifM0tSWajnQg3Vzks=; b=DT+x2muMDyBIu97esu5WkMYcQoOF774CfIoksABQuFY4GDg04gYP2Lu04ySCVr+ZC1 g6S4TlWfX3dEXQKBLsZWwxI2Nx+D6Zz+iruRqfanJ0VNI8LAX5D8YKJ6ovRZ0s0QlaBc xIFWXTQ+ze3cqcYkNcppR2lbAdHpop8wjct/jxjo4kZtz1mJWr9ah5A+4/ffy/JPxAEq 0Kl3HsRmQLRqXy4CdeDsLA4v0NRrI/IOvsUzsyNZE0yIpcYIz3dDY4ISoHQyqEGhVd5u YO+lSqXRBuLkwI2Zcl+8XMQfgWO8gZVssd0pi3gIJMXRDvXUGOPFc859HGqgmhl0mN61 /YIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=95RwYl3rqqVcTvULnrHvoQvNoIifM0tSWajnQg3Vzks=; b=CLS9Zfij0tQY7oXwCBuKUSnp5yFvwIveWlo+un/qVbe7x5S6Syr2gNEXXl8dkm+YO4 77Ut9lQBxAUYRUBtkiOgn2+NeyjrUQP4H6IqzLythhZQmcH98SuYmQ9qqIFLxNdfobKB yLuHt4WV6OsPsiXy63TG2sfevZ1epKRwa5veD64e0kBTikBhLphKHOoYoeJo2wcvEIHy o67p8eonyaEd/4qEJ64H6xFKb8KyLdEgCZp+Os+zWAowNdBl8Zb4E/sMqpxo32grILhm B6+Z5yb2VH/7ePTQkwgnY50PfsnTN2i4W5uGIKdZfy6MDYuY3sQ0ig6Vvv++VdjgZSbG dLbQ== X-Gm-Message-State: ALyK8tKaa8E3IG2b0Q1pmOJvZO6vQ1ffCuw4F2Dw4ApYCmqb7G16MCsKYloxlXTkKz3mrA== X-Received: by 10.66.75.72 with SMTP id a8mr22873832paw.99.1467306294782; Thu, 30 Jun 2016 10:04:54 -0700 (PDT) From: Bart Schaefer Message-Id: <160630100453.ZM1682@torch.brasslantern.com> Date: Thu, 30 Jun 2016 10:04:53 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Global array actually not available" (Jun 30, 4:34pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: Global array actually not available MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 30, 4:34pm, Sebastian Gniazdowski wrote: } } In code, I declare reply2 and reply3 as arrays via typeset -ga. I do } this from inside of a function. When the code returns to outer scope, } (t)reply2 and (t)reply3 show empty strings. I see your follow-up in which it appears this may be attributable to separate shell processes, but in addition please note that typeset -g does not actually declare a "global" variable (despite the mnemonic). It merely declares a "non-local" variable. The actual dynamic scope of the variable will be the nearest surrounding scope in which that parameter's name is already defined (even if both defined AND unset; in the unset case it may become set again, but it's scope remains). Thus "typeset -g name" declares a true global $name only when there is not another $name already declared (or $name is already global, of course).