'find' escape

Rick Pasotto fwp at unccvax.UUCP
Mon Jun 20 11:58:10 AEST 1988



The man page for the find command reads in part:

     -name filename
               True if the _filename_ argument matches the current
               file name.  Normal Shell argument syntax may be
               used if escaped (watch out for `[', `?' and `*').

I have always read this to mean that 'find' understands 'normal Shell
argument syntax.'  However on none of the machines that I have checked
does 'find' understand a backslash escape.  

My problem was that I needed to 'find' some files whose name started with
an asterisk (silly way to name a file I know, but I didn't do it and it
can't be changed).  Anyway, what I discovered was that 
	
	find . -name \\\*XXX\? -print
	find . -name '\*XXX?' -print

nor any other escape combination would work.  The solution was to use:

	find . -name '[*]XXX?' -print

Have I been mis-reading the man page all this time?  Should 'find' 
understand escapes?

Rick Pasotto
mcnc!unccvax!fwp



More information about the Comp.unix.questions mailing list