Is globbing a feature of the shell?

I read many questions and answers like this and this one

I know wildcards are expanded by the shell before running a command and they are a feature of the shell. Also wildcards work with those commands that can accept many arguments. In find . -name *.rb if we have more than one file in the current directory find will give us an error because find cannot accept multiple arguments and the ways to solve this are:

find . -name "*.rb"
find . -name '*.rb'
find . -name \*.rb

We escape the asterisk and prevent expansion by the shell but wildcards are a feature of the shell; when we escape the asterisk shell does not know about its meaning, and it should find a file named *.rb, so how is the asterisk being expanded in this case?


Yes, the shell understands * as all files with any characters in the directory and *.rb as all files with any characters and ending .rb, and expands it as such.

The find command itself accepts globbing.

If you don't quote the * then the shell will expand it before the find command sees its argument, so instead of a glob *.rb passed to find, the names of all files matching the glob in the directory will be passed to find, and find will try to interpret them as arguments, which will likely result in an error, or at least not what you want (it will work correctly only if there are no matching files in the current directory)