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 7786 invoked from network); 29 Nov 2021 15:32:58 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Nov 2021 15:32:58 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638199978; b=qzdeebultK4YMnIf13KiM/q3INhGzQSG3DfHcpwxcwZPYWabsWB50CPcYj8TXUJ6iygHzl4fKF kc06UeVOoKAtRh7DV2mCP2bLsXseDbq46vrbB2qnK0cvR6E7VhxzTImghFvpBC6IskLkDcTLuu i3c+vG3JdY7fSbikeFje877PBXlyBjvwvxovt8HVBvC+nvIkoIp/T7aEJkaZmplxg7lI0fvqK6 ylU8A5CoaGXyDGFymjStxQNJ337zciZ/6qXJ1nlWGq73tg5TKRbznAf3q+uYMVEZtOKIUXILch y4RNWfYEYCfhmmYP3i/ykqj30tyT8NFjIaINEkL8jGg2Rw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; 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=1638199978; bh=jMHUHk46O9mfTw1DIe530FnhrBWn7x/SqokQPqjT5gY=; 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:Date:Subject:To:From:DKIM-Signature:DKIM-Signature: DKIM-Signature; b=PIdTkXFpKpLMwrdLdRj2irLdss1w9/iyul6/pGiuk78WFDbMV0CBPGaCZ0mkrG4GvqrpO4zuFc dMHp8+z+NWKLuK1xAB9QO+/FUyMQZAtls2ex2tjZryp22TqjjnAa9HxIQRBYnR/MM8AfaDiuTo wT4I07uF4OVkT/dnJKKIT5SZvUGGTv9S3psUqWXY5sROwae5dhjiA4Q7XHYAAUHsSJL/HLbprH +XprN5ujM2fHUt0xeb0iSGh+R2ulLRB4LQjv/EnyZnkr9y07TIUQ5SrAnl2wQ+vWBVkc7FZWbb pcAbZjjRIWtDB92r9hU0a2/GQTC1vQPfLi7KmJ5JHcB3YQ==; 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:Date:Subject:To:From:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=r0zXhqgM2c3u9g5p8DXrmLKIU4+dU13XQlPNgGwgQ+A=; b=oyhmaWbnOAAIwUF84WZKFM0nvp Bfd/0eAygh5rt6+rT7v8x36lcW3qygCUAL/v44OBrR9MXZAyxc+XitB6L/tQPo96ykWfD/7soNkqt 0E+bkujJbhXLdjNfAumn2m/8QGeIyoNTiG/o+i8sipjNfk9lK61kwEupjel3gvcD66HUmDGNHhkjc fYvqNJciSZ0jnNce7v6gUBjJCq2NhNY9eV8FO6fdolHuVzxFDxGuOOXF32cZIvNgEnqMSmhrkn8Tn EAenyUygmwk+nXymgfXDhpw7dW12mGTZom3T6o0kVjB+lX9A+iSTp6AIdPSUNn1LFZogB5HJL0c3M kn3i8ybA==; Received: from authenticated user by zero.zsh.org with local id 1mrieH-000NAB-Jj; Mon, 29 Nov 2021 15:32:57 +0000 Authentication-Results: zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; 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 out4-smtp.messagingengine.com ([66.111.4.28]:53767) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mrid8-000MRs-7R; Mon, 29 Nov 2021 15:31:47 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E1B295C005A for ; Mon, 29 Nov 2021 10:31:44 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 29 Nov 2021 10:31:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=luffy.cx; h=from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=fm2; bh=r0zXhqgM2c3u9g5p8DXrmLKIU4 +dU13XQlPNgGwgQ+A=; b=OSHC8+QgV/vP3exiGe50jvpKkgBFZlZZXiFNdaF/Oz +ktP25MIvnoAtFhxCCqrb1MHV7vaor88alQAbxikkZeuzhSGxkn05vjfzEX68wbd lMKIU/1X7CIwC17cCaGEBFoUwKNfSPnAdQz7LynlUOauZWkbaA7F3YZcrpHM5To8 h/8or+xvNqH10d5PakzCy7rtG2B0cYIXk/NERp++GKMVLOQo4e0vymYR2MQn82JR onbUErfq4xcLDnC4sS6/V8crizDYrEFq2VWx+j5b/DkDaK/67g+oWhx+BjSJ7rAS Fh+JXJTAA+iU4B5is2ymLMp8qqZuGJlgFXcZFQZZI+BA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=r0zXhq gM2c3u9g5p8DXrmLKIU4+dU13XQlPNgGwgQ+A=; b=oGXBQ8fy+XmGd2uIqdx4z3 hW+naUlGuKs0+x6vWajpodTkCh4GGhShoRXTnaS0QoIU1L9K3p02LqBUIN1faOuM 9Y26v6840y1QEToDtxFAEfz7MQ78R6RXYoJRqYyRmohIuiSfKt1lWT/Z2N4fmvpp +LKjtkFQNea7dPIogqhlUDwC7OWAqoBYMhwdoOIAKafc/dZjXg5XLq8ojsibpzGX ygumwiwD3vJOkn9DNr+/LHSxqosYJ28+qcYOAP02dErdpEctQE4TsUViAOlL9CT0 pZTyQ2L9mQtklNws42o3ZFCbIyx91P9kUathFiRZp+NGutq3GvY606sUpmFYW3UA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrheelgdejkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgfgggtgfesthekredttd erjeenucfhrhhomhepgghinhgtvghnthcuuegvrhhnrghtuceosggvrhhnrghtsehluhhf fhihrdgtgieqnecuggftrfgrthhtvghrnhepfedtledvueeigeffjefftefhleeikedtke evteekgeevgffhhfffheelueekveffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepsggvrhhnrghtsehluhhffhihrdgtgi X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 29 Nov 2021 10:31:44 -0500 (EST) Received: by neo.luffy.cx (Postfix, from userid 500) id 550FACC3; Mon, 29 Nov 2021 16:31:43 +0100 (CET) From: Vincent Bernat To: zsh-users@zsh.org Subject: (z) expansion flag do not always return an array Date: Mon, 29 Nov 2021 16:31:43 +0100 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: 27382 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: Hey! The (z) expansion flag is documented to return an array, but this is not the case if we have only one word: 16:24 ❱ print -l ${${(z)${:-word1}}[1]} w 16:24 ❱ print -l ${${(z)${:-word1 word2}}[1]} word1 This can be worked around with A: 16:29 ❱ print -l ${${(Az)${:-word1}}[1]} word1 16:29 ❱ print -l ${${(Az)${:-word1 word2}}[1]} word1 But older versions of Zsh does not have that. Is there another way? Is there an easy way to know if something is an array or a string? I am using subscripting for that but maybe there are better ways. -- Don't over-comment. - The Elements of Programming Style (Kernighan & Plauger)