Saturday, February 18, 2012

find: paths must precede expression

the command
find .
recursively print all files starting from current directory

find . -name *.txt

should theoretically print only the .txt files.

It fails from the shell prompt with
"find: paths must precede expression"

this must be because the shell explodes *.txt before evaluating find.

Workaround: enclose '*.txt' in quotes

find . -name '*.txt'

No comments: