From: Zach Riggle <zachriggle@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>, Zsh Users <zsh-users@zsh.org>
Subject: Re: Globbing symlinks-to-${glob_qualifier}
Date: Wed, 18 Aug 2021 08:10:56 -0500 [thread overview]
Message-ID: <CAMP9c5nZt0Y+eazUmWJryWR4LwudGkw5RCoBm0z+-nKjdDbYLg@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7bUS3JZQVwC2jNonn2beL+3957BBAZHURwihyDiPrUC7g@mail.gmail.com>
> That'll be «*(@-/)» and «*(@-*)» respectively.
Thanks for the info (and hello to France!)
Definitely easier to read and reason about than *(#q-.)(@)
> Under the hood, «-» simply flips between testing the results of lstat(2) and stat(2).
Ah, that's useful information! Love these implementation details.
> Not an error; just zero matches. That's not the same thing.
You're definitely correct, my mistake in terminology. I'm lucky that
I got "qualifier" and "modifier" correct (I think!)
> It does become an error when NOMATCH is set
That's neat!
The "error" that I got was just '/bin/ls' complaining that there is no
file named e.g. '*(@/)' since the glob didn't find anything (and I
don't have nullglob or nomatch set). For me, it often helps to employ
Python to see exactly what's being passed in:
$ python -c 'import sys; print(sys.argv[1:])' *asdfasdfasdf*
['*asdfasdfasdf*']
$ python -c 'import sys; print(sys.argv[1:])' *(@/)
['*(@/)']
$ python -c 'import sys; print(sys.argv[1:])' *(@-/)
['pwndbg', 'pwntools']
Turning on nomatch does indeed throw an error from zsh.
$ setopt nomatch
$ python -c 'import sys; print(sys.argv[1:])' *(@/)
zsh: no matches found: *(@/)
Interestingly, it appears that nullglob takes priority over nomatch.
Yet another "Today I Learned."
$ setopt nullglob nomatch
$ python -c 'import sys; print(sys.argv[1:])' *(@/)
[]
Zach Riggle
On Tue, Aug 17, 2021 at 11:03 PM Bart Schaefer
<schaefer@brasslantern.com> wrote:
>
> On Tue, Aug 17, 2021 at 8:58 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> >
> > Zach Riggle wrote on Wed, 18 Aug 2021 03:27 +00:00:
> > > $ ls -lad *(@/) # Error
> > > $ ls -lad *(/@) # Error
> >
> > Not an error; just zero matches.
>
> It does become an error when NOMATCH is set, but not because there's
> anything illegal about writing that qualifier.
next prev parent reply other threads:[~2021-08-18 13:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 3:27 Zach Riggle
2021-08-18 3:57 ` Daniel Shahaf
2021-08-18 4:02 ` Bart Schaefer
2021-08-18 13:10 ` Zach Riggle [this message]
2021-08-18 15:24 ` Bart Schaefer
2021-08-18 16:48 ` Ray Andrews
2021-08-18 17:23 ` Bart Schaefer
2021-08-18 17:55 ` Ray Andrews
2021-08-18 22:28 ` Which options are really doing anything (Re: Globbing symlinks-to-${glob_qualifier}) Bart Schaefer
2021-08-18 23:27 ` Ray Andrews
2021-08-19 2:32 ` Globbing symlinks-to-${glob_qualifier} Zach Riggle
2021-08-19 4:38 ` Lawrence Velázquez
2021-08-19 13:23 ` Daniel Shahaf
2021-08-19 13:25 ` Daniel Shahaf
2021-08-19 14:38 ` Ray Andrews
2021-08-19 13:54 ` Daniel Shahaf
2021-08-19 4:40 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMP9c5nZt0Y+eazUmWJryWR4LwudGkw5RCoBm0z+-nKjdDbYLg@mail.gmail.com \
--to=zachriggle@gmail.com \
--cc=d.s@daniel.shahaf.name \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).