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 23810 invoked from network); 29 Nov 2021 17:44:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Nov 2021 17:44:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638207884; b=Rkgk8/WTi6+lYXExRJJrHussdzAWOcwGee8u11m9NGXc+nTmli7q+RxJtbUL9mmXVWcsQx2LWQ wbEhHyKfVwpoejtNASiMCRp0ztyb/A9wVo0kXU4EhcOKe3RYudPMmVlPiajMlwdxPS//astnU9 5X0mUsHnBWVfluJ5p1QohBaRIkPUWrJyBnyP5JWd8WGVNkagEo1D5vgYw4S/xvlg606tAfXbjH HFZvJla4RibUQh9veAybSaRqjUX/zJYakG7YBeMmfJfj6bE+oTzG1bQt//UW1ZDYgh5ljJ0O6k ZIm/cqLmCaG3842FLB0+AsGz87pTxtrUJ+zDWwh71l7SRA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=luffy.cx header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=pass header.from=luffy.cx; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1638207884; bh=NOlPh6h3DZI8cPNsOGEvlrV7+Z2Lk+xkI1zJu1/OqNA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=JGbpOxyAPR+NuzQTXXp8Cn/8CThBzytV8Pvba0HWKvqd5BniV9NKWxfUvjhgA4gqGLLsILJutc KcLHpJbdVTbpWMoyw0MIisy/z9CPscvyNTZVaecUv/qQzB+NkgomWSsPAHYwqQxffV4sHm2htQ HSg2TlBa3K9n7hTgUoXS0P9tVfWHMgKEoZPj++JTM+1l3ZRpnB0CcRJzFgC/i8GPS7rO9dqV0R toSGFgvW1O59hPoNYDeNcGe2AkQn3rQRVopsjrLUpPeXHl/pDVcPFl/kfX4qyMoPqlg3sA+IKF iealFJ6A8piLERQt+X2f6IfAJctx0vz192SoGYeRvR/8kw==; 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-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=obdkdrLR67yL7SN8YAacutMYDd6MFE1dWyWE1/eAHx4=; b=Y2LFNxNB/8JQYCXKFbvrJYJLjA Ip9SjgcKuKDYYQr0Pn/IbFrsxG+ZWBLbzGu4nMGI52gCgS7g+i/r+r2Ejp8Kth4mjbAVP9jgOsmrb maPhiM8OMAQ6Dbb8/QiiehKc4TFFF8asiEyiYBZXxS1Yqf1QU6TV3eNrp//ndSlwUpJyOpx/T92v3 keY8XM+z5g0KypvxDDkQwk/HqoP42O7UG9q5TxUHNCHTRrWFtun6tVUFQtmtobJK3KCSMua5FxfPC E6Ubeejaidgo7uThFYDIcuhvzs6Nwez6L2jUcnuFJgEt1Bv7Br4CrSv1pQ8n11YKn2MXTJTOhCjlx 0MVtt1nQ==; Received: from authenticated user by zero.zsh.org with local id 1mrkho-0006ch-9U; Mon, 29 Nov 2021 17:44:44 +0000 Authentication-Results: zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=luffy.cx header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=pass header.from=luffy.cx; arc=none Received: from out2-smtp.messagingengine.com ([66.111.4.26]:40939) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mrkgm-0005mF-I8; Mon, 29 Nov 2021 17:43:41 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6B4235C01DE; Mon, 29 Nov 2021 12:43:39 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 29 Nov 2021 12:43:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=luffy.cx; h=from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type:content-transfer-encoding; s=fm2; bh= obdkdrLR67yL7SN8YAacutMYDd6MFE1dWyWE1/eAHx4=; b=t0ip9jqVLglUOzvj dsFbVQlJuqRZdMo664a8gQeImtUJbBdetakKi/QdpxRvcqv2LPaxCjlGjSkxNvmR Ljann5zuvbl9S8knxzf0GBn0j3ziiT4m3OSE3GhGM7ipLWAT2wT9n/aJvha7Fo1t M6NwGHR+VijtoYWE3FwKf+D6QAlFDoD/rN5RcUakFtLzq6gcL3oo8fKXf3/1rnjv e8sNPaRnmlAJO16VdJ+oLAJ8DftqadW99mg/zhYADIrHhZ78cOq0phGiOe2h6PnM RZGRUGTWWRDgtKv28yqmJf1DW/9kgcFOvbTO6nMeZ9P9Lo14QPN0hsU+PGoksDx3 /G4uuw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=obdkdrLR67yL7SN8YAacutMYDd6MFE1dWyWE1/eAH x4=; b=Kh2YrsXdMQNaXHHPfwTu7Sl7EXnHpSuMl77bqD/rlUGWDNzOOdS8b0kMh /+atiRLU7XjApqnHxmar6DZ+EoNCQo1EJUBZCDwLvJkzdW2JOEmNVrhUq6qNZko2 Vx7QMTqQCcrqNtKyf2hnintoymWcb+aP9D4L7tVAqnYQPUou8ZzlbWQsf22dGpPN kPWmze5Uo7YItbSbvyfYKKksVlEzUEUkyt7iw7i1oPdcDl3OAk8O9W+zA0rwOZzy NLCqHSfjQpHNkDZv0QOFaHv69Gq8f0Qg0OGEa/I6Ctm+b3fFFOSSQ54uklh3uenD hTUk103cOcn1XeSFxiYU/haBggs8w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrheelgddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufhffjgfkfgggtgfgsehtke ertddtreejnecuhfhrohhmpeggihhntggvnhhtuceuvghrnhgrthcuoegsvghrnhgrthes lhhufhhfhidrtgigqeenucggtffrrghtthgvrhhnpeeuveejgfefgffgiefgjedttdffhe etvdeliedvueefheelgfejveffkeeflefgfeenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegsvghrnhgrtheslhhufhhfhidrtgig X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Nov 2021 12:43:39 -0500 (EST) Received: by neo.luffy.cx (Postfix, from userid 500) id 1D9C21041; Mon, 29 Nov 2021 18:43:36 +0100 (CET) From: Vincent Bernat To: Lawrence =?utf-8?Q?Vel=C3=A1zquez?= Cc: zsh-users@zsh.org Subject: Re: (z) expansion flag do not always return an array References: <1be1289c-c3a1-4730-baab-5625af464cb1@www.fastmail.com> Date: Mon, 29 Nov 2021 18:43:36 +0100 In-Reply-To: <1be1289c-c3a1-4730-baab-5625af464cb1@www.fastmail.com> ("Lawrence =?utf-8?Q?Vel=C3=A1zquez=22's?= message of "Mon, 29 Nov 2021 11:50:38 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Seq: 27387 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: ❦ 29 November 2021 11:50 -05, Lawrence Velázquez: >> 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}}'. When I read "split", I read "into an array". I must miss something. Also, it works when there is something to split, but not when there is only one word. -- Don't use conditional branches as a substitute for a logical expression. - The Elements of Programming Style (Kernighan & Plauger)