From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17302 invoked from network); 29 Nov 2021 16:51:36 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Nov 2021 16:51:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Subject:Cc:To:From:Date: References:In-Reply-To:Message-Id:Mime-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=+D3ih+LJg0zHOzY8605H2NGZy/rDpe+Nrka+6uz/TO8=; b=oWg5KPDBaXM3tXo3Npm+KSe2gk APCWvTjs+Tmh/X8UBtp1/Z6O8WBVGpd7ileVVjxZDvV+Fe5NYEan+GSxwGdOcW+kqtLQcI33GO7jY f6pNliHj25fEdVjnTkXbCLaQNFyNYvURYEs2oJIqzpw7isxs44Oo+W4CkMq7KxAlnRJC6zX06s1Ml mLge1EcNRj3STBmBqWkB0MGqm0t6umMVN+l8+3HmlQ1RJmg64CjwxvxWGP6qraC58JwWSFCO0CLdo 3vDMM103Ap6B2KHJCaWXQZZZL6YfVeB/7qz36L2VC/yThfT2O3D+MgO3cANPUv3UAanSk1n/KJi0U TGi3AF1A==; Received: from authenticated user by zero.zsh.org with local id 1mrjsO-0002ZP-Hp; Mon, 29 Nov 2021 16:51:36 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mrjrq-0001rl-5X; Mon, 29 Nov 2021 16:51:02 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 7BD6827C005B; Mon, 29 Nov 2021 11:51:00 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute4.internal (MEProxy); Mon, 29 Nov 2021 11:51:00 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrheelgdelgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpefnrgifrhgv nhgtvggpgggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqnecuggftrf grthhtvghrnhepieekjeevledugeefiefgueelgffgtddtgeehvedvhedviefghedvffeu vddvueehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eplhgrrhhrhihvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudehudek jeejtdegqdduudelvdejfeekhedqlhgrrhhrhihvpeepiihshhdrohhrghesfhgrshhtmh grihhlrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 3F45121E006E; Mon, 29 Nov 2021 11:51:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4409-g12559b250c-fm-20211129.001-g12559b25 Mime-Version: 1.0 Message-Id: <1be1289c-c3a1-4730-baab-5625af464cb1@www.fastmail.com> In-Reply-To: References: Date: Mon, 29 Nov 2021 11:50:38 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Vincent Bernat" Cc: zsh-users@zsh.org Subject: Re: (z) expansion flag do not always return an array Content-Type: text/plain X-Seq: 27385 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Mon, Nov 29, 2021, at 10:31 AM, Vincent Bernat wrote: > The (z) expansion flag is documented to return an array Is it? The 5.8 man page does not mention "array" even once. z Split the result of the expansion into words using shell parsing to find the words, i.e. taking into account any quoting in the value. Comments are not treated specially but as ordinary strings, similar to interactive shells with the INTERACTIVE_COMMENTS option unset (however, see the Z flag below for related options) Note that this is done very late, even later than the `(s)' flag. So to access single words in the result use nested expansions as in `${${(z)foo}[2]}'. Likewise, to remove the quotes in the resulting words use `${(Q)${(z)foo}}'. -- vq