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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8685 invoked from network); 9 Nov 2021 07:53:18 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Nov 2021 07:53:18 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1636444398; b=HlMG76YMG7ZdgPprj5lXo9CG0I4xLe6K+2magrZtLNULKSvUbk5QaXk28+KES2ngf0SUg0c98V SN+qdnnDnQQwlpmzEHyQTnjaRRyJSX41X+bPAT2FuyPpZ3HKuQ11QPNGntDoRn18ap2NiSk9Pm HkkwBbaL0hbvWNVOmrDpzJHibXN7tIOcAzrcXoJ6qKBzqhRlYSd9msZ7/fLCCcqFZtshLBthhX zl9cWjL6ziGnP4e0ZxEfRKWMezlw7G6kONk8SztK3jmlF65qsyS3wpjoooYLatvmWyGJ3ztX1y Rg6gL9PXibGVCTwyVDqIfToGZL7ZASr8QUhk/TbYTrQQEA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ua1-f41.google.com) smtp.remote-ip=209.85.222.41; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1636444398; bh=1ZvTQJw75haVlSYchtpVrd//DxaUaOrr0uCh2gY10nQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:References: In-Reply-To:MIME-Version:DKIM-Signature:DKIM-Signature; b=OGSY19qDakL4xp5uZn84i5EuJUW3ORNIYWK4dgp1qt3NWKH+Tjt+5dL+yJ/FPu6qj0Fr6xbvEu la70giZuWU1hBjFBznacymvgjYiqeSMtCuilJxs3d/N1LWucEMxu0jh/1VSq1bZ0InKOzEuEq6 ZZRtwVcHXM8//juOKZ86IR8TWV9cOJJculRHJnms1i3Ck4dZjM7Qk00PIBWMRjVH+/TMMpU2p5 EQwlU6ylGRjsY4q9aL/c6PoVRfKedUgZKGX2TCaKeVSHL3yjNuSQdZ+eqM1Ib8BkVctUNhuKMo g7IbQYJL8Huim9AcF93BZiZDOes5IBX4b78fxAYhKwvjSQ==; 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:Cc:To:Subject:Message-ID :Date:From:References:In-Reply-To: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=VPnJ6JLIynb4jhH37pPuzzA/qu6uDzKY30eb7cOIJAg=; b=RBf0JcWs3bv6GKE1cqroqDt6d9 JxU+g8FhZ4Akhcby6oOd9d+YiS3kEVlWgbIemA8X51iKJ3bv1PyjeOQDqXPKwDBvH4v1E/c4OYZif ZYj2ni+dZoSOr5E8bN6HDNlxUV9pbdM+CyadoMOAU5pRqKiweb770L2US4UezB4C5a3bDIh+mi75U J8cIj16KAYp4ZXvkqrSzbiFJDTeF689YTlwFpRdiKPUUQpIFNG8F3N+VmY4raogQDFmviS6qOACB4 BbBmMFg0QPGeEh14uhQe3J7H6+4RwHuSbnGY8bH2Ui2voI3O6Eu3e0rjB+UbJhR+/hihnscxXo8Uc IzUvmSqQ==; Received: from authenticated user by zero.zsh.org with local id 1mkLwR-000EwY-UA; Tue, 09 Nov 2021 07:53:15 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ua1-f41.google.com) smtp.remote-ip=209.85.222.41; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ua1-f41.google.com ([209.85.222.41]:35489) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mkLvt-000EHQ-O1; Tue, 09 Nov 2021 07:52:42 +0000 Received: by mail-ua1-f41.google.com with SMTP id q13so36887569uaq.2 for ; Mon, 08 Nov 2021 23:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=VPnJ6JLIynb4jhH37pPuzzA/qu6uDzKY30eb7cOIJAg=; b=FFTwxzQHGlHUyS1yQcTVfTxgNHR2rRkncrYDjMq9/amvLi0uvax1VPwcu2wHitnEXq FUAdKKrmGsdT7j/g+MUBZVHpX2+m6DjYuRvMjkSQ1si2v4cdpfmMPH38yCZtvRyWRy/M 8LaXyJTh1uEnRkxSc1Ze8jfL5fdW8NUAQnbdzVJD1E67lhGjMGmJQGfJhs05c1S314mT y0p+oqCr7iCiYSlcnuHawtdRFJ9N2+CcvSSpsQ3pKTshuL8QsyM9FQF/DR5mywA0IWkv DGg7BvgH+IkP/k4nLfoloSqcm4RifWvR/1EVTJvqUIqO8n+Hm4nRvUBOlcOBcNq6o+Dm sjOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=VPnJ6JLIynb4jhH37pPuzzA/qu6uDzKY30eb7cOIJAg=; b=QF47zPEZykHVUQ9j6ML1YFlWNDTejvcqoQYyH1yBOoo3sFCAycdS6Z3HiWJeV3C6Xt kbAnW+ZROE11R4pMoPhJe6H8UKBVSY5Wrf8N+Wy2BmldppD/X6973eSyUEKSLzPPQ1GP 0akeWjyqYv5rycBvhegBMF13DYSpfEeo/GcFHlBAbNyo2KCgSNzgDt/1ga78pATG9am7 xcYShpdbHbST+FHBe2cnn7iuVoabZA1s9vwi7jBU97i9ZR6PokVfPVDfwJUYH2+M2IuJ 7ztG8nZ9H/kYOg2SUwqDBA9LsRemIBicZrGZ0flYAyoeu7gMNDkfAkSzA3AmIFJGY83+ +y7g== X-Gm-Message-State: AOAM533Sllex2ua0P2ejtJcG7ymG9dPfCy7xu3ZhqT20BQ0qcppd7QxR V4opLvDCEQOXscaBgem3PVRyrvBxCGQSduqe5AQ= X-Google-Smtp-Source: ABdhPJy5iPbzR1cTf57vKkUJjBn5ah0qatuRH/sFDmeIG0GDK+SwsE4HcYpXxr48D5Jk83gIrchDhqFQm8MAgYvkLSo= X-Received: by 2002:a05:6102:50ac:: with SMTP id bl44mr8805519vsb.56.1636444359706; Mon, 08 Nov 2021 23:52:39 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ab0:2a82:0:0:0:0:0 with HTTP; Mon, 8 Nov 2021 23:52:39 -0800 (PST) In-Reply-To: References: From: Mikael Magnusson Date: Tue, 9 Nov 2021 08:52:39 +0100 Message-ID: Subject: Re: Compound Glob Specifiers To: Zach Riggle Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27335 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 11/9/21, Zach Riggle wrote: > I expect this is a case of "you're holding it wrong", but I figure it's > worth asking what the right way to do this is... > > I want to glob the equivalent of */*/somefile (not **/foo, specifically two > directories deep). > > However, I do NOT want the glob to match if any of the directory components > are a symlink. > > *(/) is the glob specifier for directories [1] > > It would then follow that *(/)/*(/)/somefile would match dir/dir/somefile > and not dir/link/somefile. > > This is not the case -- even *(/)/ (i.e. appending a trailing slash to all > directories) do not work out-of-the-box as one might expect. > > I've read through 14.8 Filename Generation [2] as best I can (my favorite > hack being the NTREF=reffile bit) but haven't found anything that suggests > how one might do this. You can do this explicitly by one=( *(/N) ) two=( $^one/*(/N) ) result=( $^two/somefile(N) ) or more cryptically () { () { cmd $^@/somefile(N) } $^@/*(/N) } *(/N) (this will run cmd even if there were no matches) -- Mikael Magnusson