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 5110 invoked from network); 21 Nov 2021 05:37:14 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 21 Nov 2021 05:37:14 -0000 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:Subject:Cc:To:From:Date: References:In-Reply-To:Message-Id: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=SopCK6l8ZPEWC1hHM6Emnhc0PWMcwXQeLaBxB8zpcnw=; b=naapvWpRa7EHq2ww54J9Hw+6lk FhjABMU2yzZRjUYpQifgvjDBQSdDrOQWWAXN1+RkjVhiyXU69xCGLw6dmyMjQT8iWcdodxqWxcmnj 8m5BmNbN+HjamN59Kh+8HDubvcwjisYqCiZTkCYC1yOdQu+F0/4c4pKT4oXjBWj0C9fH3jKr/nABj vAaZdPwd+yOO4s/eRX9c/E8etUYzTHyhGhjH826SOebGkpUw77POI5dJom3saXG4pwDh+3TEvBkgy KHG2pl4yCwWHeKZX3opr5dKVO8bKlOD8TbavQYPUfJy8pWY9sy9Bi7bBU0cJ8h9y/e61QheHlq6HC 7/wi2DHg==; Received: from authenticated user by zero.zsh.org with local id 1mofXN-0009dD-O0; Sun, 21 Nov 2021 05:37:13 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mofPB-0008O1-Nf; Sun, 21 Nov 2021 05:28:45 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 141BA27C0054; Sun, 21 Nov 2021 00:28:44 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute4.internal (MEProxy); Sun, 21 Nov 2021 00:28:44 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrgedugdekvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpefnrgifrhgv nhgtvggpgggvlhojiihquhgviicuoehlrghrrhihvhesiihshhdrohhrgheqnecuggftrf grthhtvghrnhepieekjeevledugeefiefgueelgffgtddtgeehvedvhedviefghedvffeu vddvueehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eplhgrrhhrhihvodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduudehudek jeejtdegqdduudelvdejfeekhedqlhgrrhhrhihvpeepiihshhdrohhrghesfhgrshhtmh grihhlrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id ED3C121E006E; Sun, 21 Nov 2021 00:28:43 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1371-g2296cc3491-fm-20211109.003-g2296cc34 Mime-Version: 1.0 Message-Id: <719906ad-5f27-4eaf-ba34-f559ebcad523@www.fastmail.com> In-Reply-To: References: Date: Sun, 21 Nov 2021 00:28:23 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Zach Riggle" Cc: zsh-users@zsh.org Subject: Re: Setting GLOB_DOTS for a single command Content-Type: text/plain X-Seq: 27357 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 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