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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-13-2014, 12:17 PM
|
#1
|
Member
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178
Rep:
|
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
|
|
|
09-13-2014, 12:54 PM
|
#2
|
Senior Member
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982
|
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.
|
|
|
09-13-2014, 01:06 PM
|
#3
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,374
|
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.
|
09-13-2014, 01:33 PM
|
#4
|
Member
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178
Original Poster
Rep:
|
Hi metaschima, I was skeptical but when I tried it your way sure enough it worked.
Thanks,
Joe B
|
|
|
09-13-2014, 01:59 PM
|
#5
|
Senior Member
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982
|
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.
|
|
|
All times are GMT -5. The time now is 08:00 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|