From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17099 invoked by alias); 14 Feb 2016 19:01:25 -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: 21287 Received: (qmail 25650 invoked from network); 14 Feb 2016 19:01:25 -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:content-type; bh=4cLpfe+0Zdbmmx/deO7ElZ+3Ull9H/h+XkQkgho3CYQ=; b=UURyeHz/NHHLfF9FH1dCOX8Re7nt37daOaL4W8XLh0FtLtkezyeeHN41YsrbXXcSSv Io4x+xQfrcYKzQxBK/wTeEUAM98BMwbzCKVE0s+JqNreF6B0LWRfHyN5pm/PJ7BAf0aO StCTIC51cma1T860TYBLApdL+SOZmpHa9YwmSEq4whMUVPMyZPyPRGWDuMVWeEQhrj2s pvd6KiwRBvOXSXugB0a5cEFULh+wrHx/YZhZPY8aVNLaRegD2GbdrB517CXfuiwDg+GZ I3n2Wm5zsJzZccBdVsR7TuC7Q7ol7iMmUgkdo8V0Ka61JBzpSvY9abEVGbyUxQJSdsYg pWVw== 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:content-type; bh=4cLpfe+0Zdbmmx/deO7ElZ+3Ull9H/h+XkQkgho3CYQ=; b=kEMLTvxxNcS93QSV65eU7lcOkxsqsa3f6PUVCe2hs5IMA0Js6MIL9c7x1LrWvOLbJA migeNKPV4dgAA+l7av+5m++Oe5vu3SSQdUH/4BCKsRMGEN4YhRdy7dT2RKv1HcTgBWPT s1G2bUEthOk3pEWpeNYEfQeB3LXsgj+RQQnPI/jxCwSc512dAq1t/xlgv+WHKRMU7AtG j6F3sketLWej9/mkJyqQXTz5tvSv9sxQX35Gbu8j8RiXLLXaqV3Wfu1ffOZMjaQwJvnf 50Eibf91yaVOKZ19iCJ6k26BuwNfexOySoYx2UvCitOWCSF8MbOtcS4XM8YDoYTN8tkl 1IAQ== X-Gm-Message-State: AG10YOQ5OhNTbVjhueL7B7TyV6oW1FbWmkgxe7NqHzUdQEFGfcAHb0RpLiw04p1CoX3ZwQ== X-Received: by 10.98.74.23 with SMTP id x23mr18232806pfa.141.1455476482829; Sun, 14 Feb 2016 11:01:22 -0800 (PST) From: Bart Schaefer Message-Id: <160214110140.ZM20676@torch.brasslantern.com> Date: Sun, 14 Feb 2016 11:01:40 -0800 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "eval "echo \"$a=( \${(qq)$a[@]} )\""" (Feb 14, 6:16pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: eval "echo \"$a=( \${(qq)$a[@]} )\"" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Feb 14, 6:16pm, Sebastian Gniazdowski wrote: } Subject: eval "echo \"$a=( \${(qq)$a[@]} )\"" } } say "a" holds array name "arr". This is the reason ${(P)a} exists. It wasn't fully functional for associative arrays until quite recently. } Doing: } } % a=arr; arr=( a b "c d" ); eval "echo \"$a=( \${(qq)$a[@]} )\"" The [@] is being applied to $a, not to the expansion into "arr". You meant (note one extra set of braces): % a=arr; arr=( a b "c d" ); eval "echo \"$a=( \${(qq)${a}[@]} )\"" arr=( 'a' 'b' 'c d' ) But all you really need is % echo $a=\(${(kvqqP)a}\) arr=('a' 'b' 'c d') For an associative array that works only in zsh-5.2 and later, but it otherwise works for both associative and indexed arrays (the kv is just ignored in the indexed case).