From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 3091 invoked from network); 15 Apr 2020 23:13:57 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with UTF8ESMTPZ; 15 Apr 2020 23:13:57 -0000 Received: (qmail 28713 invoked by alias); 15 Apr 2020 23:13:50 -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: List-Unsubscribe: X-Seq: 24774 Received: (qmail 1763 invoked by uid 1010); 15 Apr 2020 23:13:50 -0000 X-Qmail-Scanner-Diagnostics: from mail-io1-f42.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25779. spamassassin: 3.4.4. Clear:RC:0(209.85.166.42):SA:0(-2.8/5.0):. Processed in 0.697612 secs); 15 Apr 2020 23:13:50 -0000 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.166.42 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eNKJhnQZ+7cALiCHuKs8dSrmdsNVkVK/xyumtW3SF+s=; b=oN4vCyO3PY0RsW+RBFnsi+TeowvbeWWlkllMA+bT5wW9VZNa4STB1K40fgUxwsTG41 QrjQg6HdDe2JvEwqt+Zfm1morEsGut/xCRhS3xxSnbCBi7IIFqs7Grv23qETCKmF7OZo fF4a6gzLS9Ub45VBLhH8YBkWu0ByM8VhOYA+tGnp82MkA760q8YNFDs+01Y5Ms7XSdSj ncMSsJ86KKu/jrEK4/RJJGG0ylXrBTDfXf3jPXTm6pElVpHfNcWdF8ETBu9Bi/21E/uZ FhxbbxubDkpDbN1d5/VIpwmRQgozWeN6prRPDlfoEmkxxU6MdFWGE/qBjZhU74cEmRjU dcgQ== X-Gm-Message-State: AGi0PubHpZdCWbv+Kdzmd0wT2QXyca3Up8yQHLMHztoF9KyjSo39jChA Chg8ZGO+i++SYerJuiv8ffE9XXtYLcc3QgaXBrU= X-Google-Smtp-Source: APiQypI/i0osPUfmOY3EQywusuPMePt4w5BLHBGXeZQaCrQC5wT7SZ1s5NNzFtrfb3YquaDVxQlqEv0BzMR/0RjwzT8= X-Received: by 2002:a05:6602:2f94:: with SMTP id u20mr14075380iow.21.1586992396877; Wed, 15 Apr 2020 16:13:16 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Mikael Magnusson Date: Thu, 16 Apr 2020 01:13:15 +0200 Message-ID: Subject: Re: indirect assignment to array To: Pier Paolo Grassi Cc: Zsh-Users List Content-Type: text/plain; charset="UTF-8" On 4/16/20, Pier Paolo Grassi wrote: > Hello, I'm trying to assign the content of an array to another which name > is contained in a variable > What I tried: > > varname=newarray > typeset -a array=(1 2 3) > typeset -a $varname=($array) > > but I get an > zsh: bad pattern: newarray=(1 > > are there other methods to do indirect assignment that allow me to do this? : ${(PA)varname::=$array} (leave out the A for scalar assignment, and use AA for assoc arrays). -- Mikael Magnusson