In the first example, your shell will first expand the *.c
to match all files in the current directory which end in .c
.
So, if you have one.c
, zwei.c
, and tres.c
in your directory, your shell will expand this to
find . -name one.c zwei.c tres.c
and find
will probably get confused because you're passing a couple extra arguments after -name one.c
-- zwei.c
and tres.c
are not considered part of what you're searching with -name
.
In the second example, you're passing the literal string *.c
to the -name
option of find
. This is something that find
knows how to deal with -- and probably what you're looking for.
An alternate way to accomplish the same thing would be with a backslash escape:
find . -name \*.c
(Note also that your examples need an argument to tell find
where to start the search. This is often just .
to indicate the current directory.)
Try the same in Fish, and it will teach you a lesson – you have been a bad boy.
– user2394284 – 2016-12-22T20:44:15.130