Hacker News new | ask | show | jobs
by heavyset_go 1861 days ago
It's not using the shell glob syntax, it's just a regex compatible string. The find utility does the same thing:

    find ~/Code -type f -name *.js
Where *.js isn't using the shell glob feature, it's just a regex compatible string.

You could put quotes around it to make it clearer:

    systemctl status "*.mount"
The string is matching on unit names, and the mount units have the .mount suffix.
1 comments

> Where *.js isn't using the shell glob feature, it's just a regex compatible string.

Except it isn't, because a `*` at the start of a regex is invalid. `-name` patterns given to `find` are explicitly shell glob patterns. You might be thinking of `-regex` patterns, which GNU find also has.

It's a bit shonky when `find` does it because it's not saying "the shell pattern applies in this directory", and I regularly trip over it. It's something special you've got to know about how `find` works, but at least it's still anchored to the idea of being searched in a path that's also part of the command. There's a semantic link there.

With `systemctl status *.mount` you've not even got that. What path is being searched for `*.mount` files? Is that path part of the `systemctl` interface? Or is this just another way that `systemctl` insists on being a special snowflake that someone's decided I now need to devote neurons to?