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 4440 invoked from network); 18 Aug 2021 03:59:02 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Aug 2021 03:59:02 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1629259142; b=k8vhkmGLLoZ418HntBvvRMuPHhekwIw5B6eiYseN2aWXQ9fU3m/xxxyc95Znb/puHG2YHVZ4Vg Z/Un7ngAeRfb5w5/puscDfFRwsB9clj9kYgVZPBoEP+frrjuh6VbFsFB+oL4Rv6oo9G2ityKq5 bgP/SDfzXttkgk59Rj19jYuOgpc+GaV9KBk5TTigvKe7C4m9bUUY5Jkxj2N0sBBt8E3f2mmA5W Ev/QEsdagXe9Orx55AtvG0BNLA4s1H6h7d/UW8KPotA3KWi76ngRQO4p+EkWktZTdUImPB3xQJ Bx4rMI1I/3Qfn+eaiTCDhbKFF08/+b6UhaKK2Kr1KcwAaw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 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-20210803; t=1629259142; bh=bgewf/jinpAiep0H1FK/Y/nK9xV4tZ4r2cpRY6OPv04=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:To:From:Date: References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=bS7DS/p68Ut4TfHxDb2fQYtHfeEFuUHErNsOhfXGnBz9NCbprHxCEj3VL8+RSkl468L1h5lP4h PMaxna5BUwWBRKOLD+piKYo1YrLALqmuDsUFJwv56JdEXijnQrsshAjoxhgeKHMQzz5ZAfHFzH ajE5VfePS4hd1ZuHaDp8WICldcAfPOuN6sucKpHY+/FTMNd89FcuD8QBYcTVnGn4Y35T2vpiyu fO/6IR75t/N6ezBCI7z0Cyp63QC0peEZN6PktQjUugAh6/AbzyKhxlqW6lMLlhNY872ho9d5Dt hddNMx+GSEXcWl+u5ZeXqn7AuFPcyIa3pv+T5jqDgWE9hQ==; 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:Subject:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=7G1LvHYJ5VTPAlTWUp7cug9iiJ/pc7lloP0iRhaUqbM=; b=f+CsjaGgIrTaqDKCriUP2g2qQc ubRis4w3kJ3fYDH9Pw1OcoxEe6NqzLNBHKN3Rf6wYkUUp0nTv/pUDNgaAac/xPYP8agWFpad5DIuR +nyfwS6372nWNrBzvWRwmzGqdZ0NSDZdeN85upXDAka2dIttkV4im3JbPFbdD3kwlqtneKd1eKEsd 9kHKaDrNaQPJKoQd6w/pxVSTA4XfO7wCENolpevuIsRuJqUK27TjD9PbjlV+NEEyvWOTdsRTmqw00 aSK8YsMamrwK9ssbs1YOv9/qg4DMwD8oS2t1rqKRlpaWfGFokTjHZAWMz9ojNSga1kKoFqbDwMLGE tSceJ9AA==; Received: from authenticated user by zero.zsh.org with local id 1mGCjF-00023r-J2; Wed, 18 Aug 2021 03:59:01 +0000 Authentication-Results: zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out5-smtp.messagingengine.com ([66.111.4.29]:59045) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mGCiU-0001Ku-FM; Wed, 18 Aug 2021 03:58:16 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id AC9F75C0267; Tue, 17 Aug 2021 23:58:12 -0400 (EDT) Received: from imap37 ([10.202.2.87]) by compute6.internal (MEProxy); Tue, 17 Aug 2021 23:58:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:subject:content-type :content-transfer-encoding; s=fm1; bh=7G1LvHYJ5VTPAlTWUp7cug9iiJ /pc7lloP0iRhaUqbM=; b=v5IPksAoTV3VEP7PffZPZIOBFqnhWhfzPOrpXVyM1m /vsygE7xyUrrDdlydML9Oy+PTEWrfWLPAt2O2guw8VSdZt3MP5zsBAKpWXAJLfbI J8S3AiRSeEXOxRiMem7PcH/ORZto7e/DIpf6xRxsW7tku54UEhjuwqSQiJlbXAqQ 4KL9VvAFFFTsoykdROE9iU4xgIkyK8S5TBFtVOb8vVEqTSDCGt5KyuIJ/IxDSpHd O92WYi7TpqgXSl+BjBz/Suq/vdwGXGnI5PSMbEuFr0OaNaVxQIMmzv04ztutPwRB PqzTdZtVkU/JiTHSKxnQ2QWblHaM1r8FVs47QknVH6IA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=fm3; bh=7G1LvHYJ5VTPAlTWUp7cug9iiJ/pc7lloP0iRhaUq bM=; b=dCrZr8GWZ7tQuOnch1PgLvmoUzhbs+8x0U+oBsDPIz1Rz2UmPOHm+LC+u 2fVcC/4yeMzN2Ve4+HyB4ZbFQxOAPgpG9cxx3d4p186gppR58PPwEjlbGORRRQCl Bu9G+r+5S16zFg4YokHf2jNTBtM7yIFewfYTNcMAUHfudPUwNELSMpjzB5OgZ1uW 3aD+jhrSIG+ovg2jeo91yCj7EQnSWAevPaSPz8WWzrXHdTHZwrXfviG6LhCbW6oi qBf4XwEr321Ew1GbHlXYYYbIcUOnrRUOcFhJMmmf+fcSOnWgvH2U74yMuaR9Bm3s BkPktHXkrN7wxk+4eCVYpIXQx5IjQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrleeggdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdffrghn ihgvlhcuufhhrghhrghffdcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg eqnecuggftrfgrthhtvghrnhepfefhkeefveeileelheeiffdtkedujeelvdfhtdejtdeg gedvuefffeelhefhvdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 194D46B4006A; Tue, 17 Aug 2021 23:58:12 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1118-g75eff666e5-fm-20210816.002-g75eff666 Mime-Version: 1.0 Message-Id: <8e20a9ea-d705-4a1f-97ca-ff6b809f6a92@www.fastmail.com> In-Reply-To: References: Date: Wed, 18 Aug 2021 03:57:50 +0000 From: "Daniel Shahaf" To: "Zach Riggle" , "Zsh Users" Subject: Re: Globbing symlinks-to-${glob_qualifier} Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 26948 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: Zach Riggle wrote on Wed, 18 Aug 2021 03:27 +00:00: > UPDATE: Managed to figure it out on my own (see update at the end), > but thought this was still worth posting in case the mail archives get > indexed by Google. +1 > My question is whether there's a way to combine the @ with any of the > other glob qualifiers -- i.e. to glob for symlinks-to-directories or > symlinks-to-executables. That'll be =C2=AB*(@-/)=C2=BB and =C2=AB*(@-*)=C2=BB respectively. The = =C2=AB@=C2=BB tests the directory entry for being a symlink, then =C2=AB-=C2=BB flips to "testing the directory = entry, unless it's a symlink in which case test what it points to", and =C2=AB/= =C2=BB tests the symlink's target for being a directory. Does not require extendedglob. Under the hood, =C2=AB-=C2=BB simply flips between testing the results o= f lstat(2) and stat(2). > Many of the glob qualifiers are specific, simple, and well-documented > -- *(*) for executables, *(/) for directories, *(.) for files, and > *(@) for symlinks. >=20 > I tried the obvious combinations, but these didn't work. Not surprisin= g. >=20 > $ ls -lad *(/) # Shows all directories > $ ls -lad *(@/) # Error > $ ls -lad *(/@) # Error Not an error; just zero matches. That's not the same thing. These particular commands will _always_ have zero matches, because no directory entry can be both a symlink and a directory. (A dirent can be a symlink _to_ a directory, but a symlink can't _itself_ be a directory.) > Ultimately, I managed to sort it out and everything works how I want! Thanks for sharing your steps! It's helpful for our next design discuss= ions :) Daniel