[CS3190unix-list] Re: [CS3194-list] "find" command arguments -- quote or not?

Travis Miller tmiller at trinity.edu
Thu Feb 12 20:00:20 CST 2004


Everyone might also want to note that you can get away with not using 
the quotation marks if you escape the wild card character (*) with a 
backslash (\).

For example, to find all of the .java files in a directory structure you 
could use:
find . -iname \*.java

For those of you that are as lazy as me, that is ONE less character to 
type than quoting. *grin*

- Travis



Berna Massingill wrote:

>To clear up a minor detail from Monday's class (and try out this
>mailing list):
>
>You may remember that Monday in class I was surprised to find that
>apparently it wasn't necessary after all to put arguments to "find"
>containing wildcards in quotation marks, since I got the same results
>with
>
>    find Classes -name *.java
>
>as with 
>
>    find Classes -name "*.java"
>
>I had always read that you needed the quotation marks to keep the
>shell from expanding the wildcard, so I was surprised that the first
>version of the command worked.  The explanation is that if the shell is
>unable to expand a wildcard, it just leaves it unexpanded, and since
>there were no files that matched the "*.java" in the directory where
>I executed the above commands, the "*.java" was passed unexpanded to
>"find".
>
>To see the effect of this, try a command such as "echo *.c" first in
>a directory that contains at least one file that matches the wildcard
>and then in a directory that doesn't.
>
>Well, *I* was glad to clear that up.
>
>-- blm
>_______________________________________________
>CS3190unix-list mailing list
>CS3190unix-list at mail.cs.trinity.edu
>http://www.cs.trinity.edu/mailman/listinfo/cs3190unix-list
>
>  
>



More information about the CS3190unix-list mailing list