I was using
find -iname *prib*
and getting only one result "./prib09jack.pdf" with
find -iname "*prib*"
I get many more results that I was looking for such as
./Dir1/PRIB09/prib09jackTFF1.pdf
and many more, but why did it matter that the quotation marks were around "prib"?
Best.
Answer
If there is a file (or files) matching *prib*
in the current directory when the find command is run, the shell will expand the wildcard to match the file name(s) first before handing the arguments to find, and result in a different command being run than the user expects.
For example,
$ ls foo*
foobar
$ find -iname foo*
./foobar
$ find -iname "foo*"
./foobar
./dir/foobz
./dir2/fooblat
In short, Quotes delay wildcard interpretation for the find command to perform. Lack of quotes expands immediately.
No comments:
Post a Comment