When I have a nested directory find . -name *.py -print command gives me all the python scripts beneath current directory. However, find . -name *.py -print returns only the python scrips in current directory. Is this expected behavior? What makes this difference? I use Mac OS X 10.7.
The difference that quotation marks make in find command
command line;find
It's probably not the same command. You could put echo in front to check.$ echo find . -name *.py -printfind . -name *.py -print$ echo find . -name *.py -printfind . -name foobar.py barfoo.py -printWithout quotes, the shell expanded *.py, so find gets different arguments, which yields different results.You should always quote * when you want a command to see * literally. Otherwise the behaviour will be erratic (the command works as long as there are no *.py files for the shell to expand to).