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 26718 invoked from network); 23 Nov 2020 04:06:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Nov 2020 04:06:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1606104371; b=KZqhaLFuMq9nmc1+rAE0z5MqWEzBxdozxRiUZ5bWQK9LCMskaKaswBWfBTV1r3gOgYfCHiNaHZ a7EzRvJAaoei1nwTxqZLWahuZPhxhPQQWxvb80A9aVNvE+nMyrR8Rl6doAdisqfmYRhlqcDkyt 5eZu1T6ihdJJCnPuSfcu1TeJu9xTGdcwdCeEsU4Zrk1H9UdX85MgGtGc4Y8FKn2h/5LBaNOmSD nUoxDNl3fHZO+ujw1l1dKOq5Bvm3j18S1SFIi3xzDQJgNIApKWVetLRf4p7I3+/lNL2BfNRGuT 2XSjJGAltsH9iawUH1I7bov1sQoBUx/EYK95uhzQSbFjww==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out3-smtp.messagingengine.com) smtp.remote-ip=66.111.4.27; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1606104371; bh=oTlXWqIgm5I3k4kzbFlNIGk5XiLXDeQEquhXvQU/rPI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature:DKIM-Signature; b=Rn+bksDC17/dKfUIEZMpQ9Yx4YoMLqEFWVMMUbXfTpiEDP9UIy0riNAS8pNiCvBnNxvczhHlZP ihc0cownf3Cr3LA9MSqQcvyV1d04U5OBjq58k1U5Fcni73sBIjCz3bI/jmLmby2Tg7adJCQrTW eWXCi/hjnt8jJ9ilXzVGkhs95qVXUEaJje46IfVxfL/Z5ryn83Jk7Myn+i820XXwXpGIqbpXyM J2l5Vyh5L5xUihqQSCoCBy/iPbWetnz0wpvbZjkwO8Zg51pAE6aotmecOeFeYlyaAJ3gWJxAnk k2MDmQEe4NCCQuDDifXO7ZB1haBBsI0Sx+cWU5Qi0Y77Bg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=cnHCAOVWTUxoGaoKlZpLps1lV/0tHXMwnb21ReWDwOU=; b=AChhLF5+Mvk7VidMtrVHD2l2rn hhTHtF8nUFRxketieTrtdMsoxZYvxO61GtYrpDSiwZlcvrTxUbsbAoJJcUhCsEC1zwyn2NUw3L7Dr F3G5Klw3XLeKNLzMj0CeX43AYXqoluNa6X/BjR+PnFEdPXWVyy0AFPNIjhS4MIthSPwXps8gxBNRk IdMPYf2+DHZjJscn2dEia9S77NEHvixgFF5gl9xpCKxc3hmQ8hYMgrrSSNISZMELonUXT6+b0kcAP g9HhJq6VadKCKjRsys4V1PUW0IykI4Q3xLoCqa9RpfLzk1Owrh8pP/QQiVk20eo1hR6Y7oUC05xkZ ZwI6YWdQ==; Received: from authenticated user by zero.zsh.org with local id 1kh37C-000Lhu-3t; Mon, 23 Nov 2020 04:06:10 +0000 Authentication-Results: zsh.org; iprev=pass (out3-smtp.messagingengine.com) smtp.remote-ip=66.111.4.27; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out3-smtp.messagingengine.com ([66.111.4.27]:36839) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kh371-000LYh-FR; Mon, 23 Nov 2020 04:06:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 9B2DA5C00D9; Sun, 22 Nov 2020 23:05:58 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 22 Nov 2020 23:05:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=fm1; bh=cnH CAOVWTUxoGaoKlZpLps1lV/0tHXMwnb21ReWDwOU=; b=rgjNAQAXfLGaXA+q5ux 0m1gKzjFM5mJiv7dTUyr6Up1qCOq8IIxlBVQObub8Cqn/UoQuPBCwPCIJlGZ6vCc PrpKiUld/3HVgb34kmhBAfCUax3NFS0+a+cdincKeRK/fJLfJuFWrG5St8NKGzj3 sIx3/vSO5J4nFK8ZF3uAKEKt0oAWOMMwW3qCc4v2WCrDUrhIihAvfC0v7UD6pIN6 UTKvuG4ZmFAhJp5f9dAfKelLO5NNpImN0vjE05DEtOJjDHn9UAd6j0WEjwnOzdKN xKVfjJF4/BQ8on3y8G+oIigEehJqTxLqqT7pycL1egRR+lSm3Xvm4E09/58mcH7h s8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=cnHCAO VWTUxoGaoKlZpLps1lV/0tHXMwnb21ReWDwOU=; b=hiXY9knYkdmS1i81z5Ph5S KHBBMmuQNXkWC3MJ/Jbh7NC6FN56+tRepTGZcnXh8jHcKS1hK7/DySs+8ZREzBDZ 9WTKmkM5EV9Y2CsqiiPcKFML/1z28SZYd8F+ulELxZdJe866lk80S49aDgNgIYzL mNq/8Ib3FpFL+AJ0f602FZzDo+D4ztAJoF8qo5mLR7J7z11eiqhQltfnmPwgY10A MlQGcg3rBnyQNTMX0e0KfS8pVtCe6I48nrbpWOVNQxoTZYfu1xn+aut+oLjseRQX Is62RpzELJFDsWKjxgYR3dSY65Fx8+EMHapyms7I1xVgMEHEXOapBjfbXTBzDgmg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeghedgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjfgesthdttddttdervdenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cuggftrfgrthhtvghrnhepueevkeefffeufeehfefhgefffedviedthedtgeeljeelvdei hfevjeefteegvdeknecukfhppeejledrudektddrieekrddufeehnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhs hhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-79-180-68-135.red.bezeqint.net [79.180.68.135]) by mail.messagingengine.com (Postfix) with ESMTPA id B085A3064AAE; Sun, 22 Nov 2020 23:05:57 -0500 (EST) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4CfYVD0Smzz3kK; Mon, 23 Nov 2020 04:05:56 +0000 (UTC) Date: Mon, 23 Nov 2020 04:05:56 +0000 From: Daniel Shahaf To: Peter Stephenson Cc: zsh-workers@zsh.org Subject: Re: Brace expansion in command position Message-ID: <20201123040556.GA31253@tarpaulin.shahaf.local2> References: <37c503f2-a4f5-4074-b33e-08505abaaaf7@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 47599 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Peter Stephenson wrote on Sat, Nov 21, 2020 at 17:56:35 +0000: > On Sat, 2020-11-21 at 15:31 +0000, Daniel Shahaf wrote: > > [[[ > > % type pwd > > pwd is a shell builtin > > % {pwd,-P} > > zsh: command not found: pwd,-P > > % builtin {pwd,-P} > > /home/daniel > > ]]] > > > > I expected the second command to do what the third command does. > > "{" in command position introduces a list to be run in the current > shell, not a brace expansion. So this is treated as { ... } where the > ... here is the single-word command "pwd,-P" as a comma has no special > meaning at this point. > > Actually, other shells require a space after the "{", as well as a > command terminator ";" or newline before the "}", but zsh doesn't. > Other shells don't need a space or terminator in the subshell form, > with parentheses (...), so this is another of those minefields it's > quite hard to pronounce definitely on. (This may not stop other people > trying, excuse me if I don't take the bait :-).) It's okay, there are plenty of fish in the sea ;-) Seriously, thanks for the answer. This seems to be partially covered by A02alias.ztst:"Aliasing reserved tokens", but I don't see any test specifically about this, so: diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst index 35a04e7d5..c9a381812 100644 --- a/Test/A01grammar.ztst +++ b/Test/A01grammar.ztst @@ -939,3 +939,8 @@ F:Note that the behaviour of 'exit' inside try-list inside a function is unspeci $ZTST_testdir/../Src/zsh -fc '{ ( ) } always { echo foo }' 0:exec last command optimization inhibited for try/always >foo + + function 'ls,/' () {echo success} + {ls,/} +0:current-shell blocks masquerading as brace expansion (test to ensure behaviour changes aren't unintentional) +>success