Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
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.
|
|
05-11-2017, 10:52 AM
|
#1
|
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240
Rep:
|
displaying full path using find in multiword directories
I know that normally if I want to make find show the full path of a file, while I'm in any subdirectory (such as /home/user), I can do something like this:
Code:
find `pwd` -iname "whatever"
The problem is that, if I'm in a directory that contains several words, I get an error. For instance:
Code:
find `"pwd"` johnrsnf.txt
find: ‘/home/quas/lynda/awk’: No such file or directory
find: ‘Exercise’: No such file or directory
find: ‘Files’: No such file or directory
johnrsnf.txt
So how do I proceed in this case?
|
|
|
05-11-2017, 11:33 AM
|
#2
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
You need the quotes around the results of the back ticks - you have it the other way. It should be:
You can also do the newer way:
That's a little cleaner as it eliminates confusion between back ticks and single quotes (or double quotes).
Last edited by MensaWater; 05-11-2017 at 11:34 AM.
|
|
|
05-11-2017, 12:18 PM
|
#3
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
adding the -name {fileName} to find eliminates everything it is looking at. Unless you like watching it do that.
Code:
userx%slackwhere ⚡ scripts ⚡> find $(pwd) -name testfile
/home/userx/scripts/testfile
|
|
|
05-11-2017, 12:20 PM
|
#4
|
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240
Original Poster
Rep:
|
There was a mistake in my post. Of course, I meant to write -iname or -name, otherwise it wouldn't have made much sense.
Anyway, thanks, Mensa, I was placing the quotes inside instead of outside.
|
|
|
All times are GMT -5. The time now is 03:36 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
|
|