Inconsistency in find ... -name ...

Andrew DeFaria Andrew@DeFaria.com
Tue May 16 06:15:00 GMT 2006


Eric Blake wrote:
>> Using find, I didn't protect spec in -name (-name 'spec') in a couple of
>> instances but they still worked, viz-a-viz:
>> $ find /home/lowella -type f -name *.h
>> /home/lowella/CVSROOT/src/newlib/doc/ansidecl.h
>> ...
>> whereas a couple of others didn't work, viz-a-viz:
>> $ find /home/lowella -type f -name *.txt
>> find: paths must precede expression
>> Usage: find [-H] [-L] [-P] [path...] [expression]
> echo is your friend. Try:
>
> $ echo /home/lowella -type f -name *.h
>
> And notice that since there are no .h files in the current
> directory, the shell passes the glob through unchanged
> to find. You can also do 'shopt -s nullglob' to change that.
I've wondered about this. Does bash special case the find command then? 
Which other commands does is special case like this?
-- 
Don't tell anyone, but duct tape is The Force. It has a dark side, and a 
light side, and it binds the Universe together.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list