LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   [GNU find version 4.2.27] find: paths must precede expression (http://www.linuxquestions.org/questions/linux-newbie-8/%5Bgnu-find-version-4-2-27%5D-find-paths-must-precede-expression-890112/)

mechagojira 07-05-2011 10:34 PM

[GNU find version 4.2.27] find: paths must precede expression
 
I have difficulties with the "find" command. Maybe I'm just not understanding really how to use it.

Let's say I am searching for all files with the extension "xsc":

Code:

[prompt]$ find ~ -name *.xsc
/home/mechagojira/project/foobar.xsc

Okay works. Now I want to search for all files ending with "xsc" and maybe followed by something else, this gives me this error message:

Code:

[prompt]$ find ~ -name *.xsc*
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]

Why does this not work?

I'm using
GNU find version 4.2.27
on
CentOS release 5 (Final)

bigrigdriver 07-05-2011 11:21 PM

Here's one explanation: http://www.programmersheaven.com/use...de-expression/

knudfl 07-06-2011 02:39 AM

*


find ~ -name *.xsc* : Use quotes → → find ~ -name "*.xsc*"

MTK358 07-06-2011 06:34 AM

knudfl's solution is correct.

What's happening it that bash is interpreting the wildcards (in your case, turning them into a list of all files matching "*.xsc*" in the current directory) before passing them to find.


All times are GMT -5. The time now is 12:31 PM.