To formulate a bit more explicitely:
Should I quote the argument of the name option
of the Unix find command?
Can anything bad happen if I don’t quote?
Or can I save the extra finger wear caused by typing (unnecessary) quotation
marks?
The answer is:
Yes, you should always quote.
To see how the command looks like when the shell has processed it, we just echo
the command.
As long as there is no file with the same name, the result is identical without
quotation marks.
But as soon as there is a file with a name that fits, it’s resolved.
In this case this would mean that we only search for files named
insecure_private_key.
$ echo find . -name "*insec*"
find . -name *insec*
$ echo find . -name *insec*
find . -name insecure_private_key
In this case the directory contains a file named insecure_private_key.
When there is no matching filename, you could omit the quotation marks, as in
this example:
$ echo find . -name "*creator*"
find . -name *creator*
$ echo find . -name *creator*
find . -name *creator*
But do you really wanna check if there is a filename that could cause trouble?
Better always quote when you use find.