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,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8375 invoked from network); 24 Nov 2021 02:21:08 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 24 Nov 2021 02:21:08 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1637720468; b=AAwcz7YXjYI1nIpo9it0sxq51o+aL4nrFvYIOFTIhG/GuOOZZB6LSYkDQc+cwLjjOX0KQnm3g+ +sLeOGv1MS3NQOKywfEQlhKDVOwvcvxYwlDccy+8LGOWukAjf/RP8fk38ERr/K32aQo4xoCrnT XYIW0te/3rx5jEJokBOwMV4KAZPWirJTXc0xssC41N45iPyYj4GWMMgP8Df1Q45tj+REdoYJh7 B93XjELjmYAA7SZoTy4Q5Y27ZmZFCSoMYt9q3OPCDWRwzUf5UawvWKHAn0qGc6Ir/+RQ516I7y udsbi6uwN6R/nNajmiGyWmq4NwVZYgxse9HU8Su4RV+gPw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wm1-f43.google.com) smtp.remote-ip=209.85.128.43; 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=1637720468; bh=fRvywsJT3JhYEOrp8TQDlR+LCn57cn3bfNL8j/yDRy4=; 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:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=E9CjPM9+NGNpWQ5/pWnpaGiCaAsVBeQET1Y0hsLa8am5V+rG5RDA58YrJhh8pExNbBHcAAd82L Pq+VkA1CkK3fctDnCLQg/xDEfG4XCwr6liPiddWTE1GxGSVB8Bee0WlD1SO1xDuKm3JjC238an oRhM+e3C66/b1vlcSfLfX45z6fJueLbjCdeZ8SAdwaVDZyVhl3FDxAd4kYJXYFYH87TtSal7+a ji0tJg2M+3GSexmD0uaV9W6I2TMYDxkgXHSOK8155wAPShPe9LBEN4XOiigLR07vxpOZGcI2jM GN8HcII5mmda09XqotUOl5wZazcOL/0viEC5qoQX0vDJmQ==; 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:In-Reply-To:References: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=sdcnQwKpp2KA2u1IQQeBwitUtM6E5Ljtk05NE7caZYc=; b=TfCZL4RVmwaupRcQDFLm8IBAvW h9+6MsLqyAtVvCilzegnTdqrK+E4xOa69uy7KOYGp/WpfzQksu1l2zvnt71cDql0lXWfbpLsYruP4 rM85eiyXqLKml28qfzuQSWvKzalAAoLtZLbxiolSHgz9X7jUnfD3FmRfRTOMDXwfWmV3Zwr1Ubvov srV7e+PP7LyS2XXfrWC567x5FrOwJatt+GhDESI4YgKcEW73mDsbwXksHeXRwsSs50/I0LRdeYC6A zpW8C6IofJs/16ZgNUL70qzGj/LLLJL6IW7tNXtLKfYd0pwevlHnFRZso0dUGaNSKi76IDg1IbgjD P1eat9fA==; Received: from authenticated user by zero.zsh.org with local id 1mphuF-00079q-2A; Wed, 24 Nov 2021 02:21:07 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wm1-f43.google.com) smtp.remote-ip=209.85.128.43; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wm1-f43.google.com ([209.85.128.43]:55012) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mphtM-0006TS-Gz; Wed, 24 Nov 2021 02:20:13 +0000 Received: by mail-wm1-f43.google.com with SMTP id i12so760661wmq.4; Tue, 23 Nov 2021 18:20:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sdcnQwKpp2KA2u1IQQeBwitUtM6E5Ljtk05NE7caZYc=; b=MLSsMi6x/AyrsP+AvezZ9enB95LlAHKosIlKm1iJJJfJT4lM7Jy5sdqPFthCeiyFBA k5zxJrYPypwkgWzRlpQUdtiF+mtMOfJWESclZtsVsWFoICN8K1/Sa1IUtRjykTiBLdXI iFEFCz+WWxCXYpq/GmSQRs1tiPlqKvB3qQfXBqyGXtbYvN/Hf+2ZiGnJBehgtJQlwJ9g d+gTL+BaUdqp+/FZ3xbTEtNhtqx7yT/PjB6YMcpgyjeNgKaEg65Xk819KCUqD+xjGV+G 8kPA7rOpi5tlZU51zMzHpj0uA9wHddhHsnOpJ7Zn5tF1q9/TP70AsuOT04HlgQWRIZ32 EevA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sdcnQwKpp2KA2u1IQQeBwitUtM6E5Ljtk05NE7caZYc=; b=EN6xK4lBPup6ZtU3w2LnjyQmgtL63j7UEwBNgQuhw25fY4OdJmp+m7FN2T2I9f81UE xFqEFQ7NaMfylhjSJnaMGSQp6sACSLF05nyRExr6uJ1Dr5hcYC5VvWRwBxFvi5ej81lm yqPC1iPUIpxca2H6ySxdHMFBsPQy384Ey/eQFgLRT6d+bkZPNtKK+3fOqUgWsIwsZsnU saXeMwPPvYs0vYSx7idO/0VBrwJlHJjNe3hrFa/8bZMDInY55YMcNn0zo2GEZZWZ8nGu 9zqkLAsqGrZ+fWilVRER1p1EZq72i5ShP+EdLzp+qcU7CGqtzYaoBYypZx7qdvx9EmNs 0Hrw== X-Gm-Message-State: AOAM531+aVMtKapsUZceoJG5JEHp9UE5+yJEi4H8VLPDSshs4UMD9P/s O29EfaH0PxTsJ6+ZXPvQbPWubOWhP1eI59uhV7lrpV1gOWin3g== X-Google-Smtp-Source: ABdhPJzRDhtO1m8tIwH+U2Ae49/229wDW3+sKaDIega6qY7XtKgGhHV286JKtjLxxgaES5HswUDGT5EpZFdEmFUcObs= X-Received: by 2002:a7b:c94e:: with SMTP id i14mr9652419wml.85.1637720411418; Tue, 23 Nov 2021 18:20:11 -0800 (PST) MIME-Version: 1.0 References: <719906ad-5f27-4eaf-ba34-f559ebcad523@www.fastmail.com> In-Reply-To: <719906ad-5f27-4eaf-ba34-f559ebcad523@www.fastmail.com> From: Zach Riggle Date: Tue, 23 Nov 2021 20:20:00 -0600 Message-ID: Subject: Re: Setting GLOB_DOTS for a single command To: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= Cc: Zsh Users Content-Type: multipart/alternative; boundary="0000000000005d330405d17f7fba" X-Seq: 27360 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: --0000000000005d330405d17f7fba Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Indeed, it does appear that the D modifier does what I want! Thanks Alex, Bart, and Lawrence. *Zach Riggle* On Sat, Nov 20, 2021 at 11:28 PM Lawrence Vel=C3=A1zquez w= rote: > On Sat, Nov 20, 2021, at 11:46 PM, Zach Riggle wrote: > > I recently learned about GLOB_DOTS, which is pretty useful in some > > scenarios, e.g. > > > >> echo *(md-1) > > > > To show all files modified within the last day. However, in some cases > > I want to see hidden files (e.g. ./.foo) as well. The globdots option > > is excellent for this! > > > > Is there an easy way to set this for a single expression? > > Yes, the "D" glob qualifier. > > % touch {.,}{a..c} > % print -r -- * > a b c > % print -r -- *(D) > .a .b .c a b c > > > I know I can use a function / anonymous function combined with > > LOCAL_OPTIONS to get this, but I wondered if there's something more > > clever. > > > > [...] > > > > I expect that there's something I can do for scripts that I fully > > control, to declare some function ('globdots') which is invoked with > > noglob, and can then internally set the flag, and then trigger > > expansion of each argument in "$@". > > > > [...] > > > > I can just invoke "eval" on something that I KNOW will be a glob > > expression to get it to expand, but blindly calling eval will execute > > things that are NOT glob expressions, and I only want filename > > expansion. > > > > What I have found that DOES work (but overkill and a hack) is just to > > shell out to zsh again, while passing in all options that are currently > > set -- plus globdots. > > > > [...] > > > > Then there's also the issue of causing filename expansion to occur when > > unintended -- for example, if '*' is indeed just a string argument, and > > should not be subject to expansion. I think this corner case I can > > ignore, as any user will explicitly be asking for glob expansion. > > What verve! Fortunately you don't have to do any of this :) > > > Finally, I wanted to say that I genuinely appreciate the help and > > answers I've gotten from this community. You're all very welcoming, > > experienced, and get down to the point / answers quickly. > > On behalf of the actual helpful people, you're quite welcome. > > > If there's any way that I can help support Zsh development or the > > community around it, please let me know. > > I think your using zsh is already quite supportive! > > -- > vq > --0000000000005d330405d17f7fba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Indeed, it does appear that the D modifier does what I wan= t!

Thanks Alex, Bart, and Lawrence.

Zach Rigg= le



On Sat, Nov 20, 2021 at 11:28 = PM Lawrence Vel=C3=A1zquez <larryv@zsh= .org> wrote:
On Sat, Nov 20, 2021, at 11:46 PM, Zach Riggle wrote:
> I recently learned about GLOB_DOTS, which is pretty useful in some > scenarios, e.g.
>
>> echo *(md-1)
>
> To show all files modified within the last day.=C2=A0 However, in some= cases
> I want to see hidden files (e.g. ./.foo) as well.=C2=A0 The globdots o= ption
> is excellent for this!
>
> Is there an easy way to set this for a single expression?

Yes, the "D" glob qualifier.

=C2=A0 =C2=A0 % touch {.,}{a..c}
=C2=A0 =C2=A0 % print -r -- *=C2=A0 =C2=A0
=C2=A0 =C2=A0 a b c
=C2=A0 =C2=A0 % print -r -- *(D)
=C2=A0 =C2=A0 .a .b .c a b c

> I know I can use a function / anonymous function combined with
> LOCAL_OPTIONS to get this, but I wondered if there's something mor= e
> clever.
>
> [...]
>
> I expect that there's something I can do for scripts that I fully =
> control, to declare some function ('globdots') which is invoke= d with
> noglob, and can then internally set the flag, and then trigger
> expansion of each argument in "$@".=C2=A0
>
> [...]
>
> I can just invoke "eval" on something that I KNOW will be a = glob
> expression to get it to expand, but blindly calling eval will execute =
> things that are NOT glob expressions, and I only want filename
> expansion.
>
> What I have found that DOES work (but overkill and a hack) is just to =
> shell out to zsh again, while passing in all options that are currentl= y
> set -- plus globdots.
>
> [...]
>
> Then there's also the issue of causing filename expansion to occur= when
> unintended -- for example, if '*' is indeed just a string argu= ment, and
> should not be subject to expansion.=C2=A0 I think this corner case I c= an
> ignore, as any user will explicitly be asking for glob expansion.

What verve!=C2=A0 Fortunately you don't have to do any of this :)

> Finally, I wanted to say that I genuinely appreciate the help and
> answers I've gotten from this community.=C2=A0 You're all very= welcoming,
> experienced, and get down to the point / answers quickly.

On behalf of the actual helpful people, you're quite welcome.

> If there's any way that I can help support Zsh development or the<= br> > community around it, please let me know.

I think your using zsh is already quite supportive!

--
vq
--0000000000005d330405d17f7fba--