LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-13-2014, 12:17 PM   #1
jbruyet
Member
 
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178

Rep: Reputation: 7
Sometimes find doesn't like wildcards


Hey all, why does find sometimes not like wildcards? Here are two recent examples. This one doesn't like a wildcard:

Code:
[root@Bopper jobee]# find / -name nrpe*
find: paths must precede expression: nrpe-2.15
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
[root@Bopper jobee]#
and this one does:

Code:
[root@Bopper jobee]# find / -name foo*
/etc/foomatic
/usr/share/cups/model/foomatic-db-ppds
/usr/share/foomatic
/usr/share/foomatic/db/source/driver/foo2oak-z1.xml
/usr/share/automake-1.11/am/footer.am
/usr/share/doc/foomatic-db-4.0
/usr/share/doc/foomatic-4.0.4
/usr/share/doc/foomatic-4.0.4/foomatic-db-engine-4.0.4
/usr/share/doc/foomatic-4.0.4/foomatic-filters-4.0.4
~
[root@Bopper jobee]#
Googling this doesn't bring up anything I can use.

Thanks,

Joe B
 
Old 09-13-2014, 12:54 PM   #2
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
You must quote any wildcards passed to other programs or bash will expand them before the program can.
Code:
find / -name 'nrpe*'
should work properly and not expand to 'nrpe-2.15' which is in your current directory, and bash expands it and passes that to find.
 
Old 09-13-2014, 01:06 PM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,129

Rep: Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374Reputation: 7374
remember, in linux the special characters like * and ? will be expanded before execution. You can check it by inserting an echo before your command.
 
1 members found this post helpful.
Old 09-13-2014, 01:33 PM   #4
jbruyet
Member
 
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178

Original Poster
Rep: Reputation: 7
Hi metaschima, I was skeptical but when I tried it your way sure enough it worked.

Thanks,

Joe B
 
Old 09-13-2014, 01:59 PM   #5
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Nothing to be skeptical about. Each program expands wildcards, if you let bash expand them you will get a different result than if you let find expand them.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find doesn't find ? santana Programming 3 01-12-2010 04:13 PM
wildcards with find tramni1980 Slackware 2 10-03-2009 05:47 AM
RAR - Archiver - Wildcards doesn't seem to work... ??? nitric Linux - Newbie 1 05-20-2009 05:59 AM
Search doesn't find everything it should gargamel LQ Suggestions & Feedback 2 02-18-2005 03:16 PM
9.1 doesn't find apps (?) Jiawen Mandriva 6 09-10-2003 11:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration