I'm not sure if this is exactly correct. But I believe putting it in quotations makes the parser read it as a regular expression. Without quotation marks, I believe the asterisk represents all the files in the current directory.
Check the difference in output between:
$ echo $(find ./ -name *)
and
$ echo $(find ./ -name "*")
So, with the first command you will likely get an error. If you have the files foo & bar in the current directory, the asterisk represents the filenames. So the command parser would read the command like this:
$ echo $(find ./ -name foo bar)
And the error output would be find: bar: unknown primary or operator
.
The second command reads the asterisk as a regular expression, denoting search for any filename.
Edit: Though now, after testing the commands more, it seems on my system it works whether or not the argument value is in quotation marks, as long as some text is combined with the asterisk:
$ echo $(find ./ -name *foo)
is the same as
$ echo $(find ./ -name "*foo")
Perhaps I misunderstand the question?
find
, something else?) Also, where did you get the idea that it would be a regular expression? – ilkkachu Nov 28 '17 at 11:37find
utility? I don't think it is, they implement two different languages. Or the difference between regular expressions and shell patterns? They, too, are two different languages. Of course they share some features (like character groups/ranges/classes, like[ace]
), and are used for pattern matching, but they are not the same. – ilkkachu Nov 28 '17 at 11:46