Re: dumb question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2012-01-04 at 13:19 -0800, Paul Allen Newell wrote:
> On 1/4/2012 4:38 AM, Patrick O'Callaghan wrote:
> >
> > I know you and Ed (and Marvin) have been round the block on this, but if
> > you'll allow an oldie to sum up:
> >
> > Makefiles are not normally executables, in fact they aren't normally
> > Shell scripts. Therefore they don't need to have the +x attribute. It's
> > easy to list the Makefiles on your system and check this:
> >
> > ls -l $(locate -b -i '\Makefile')
> >
> > poc
> >
> poc:
> 
> Thanks for the additional info.
> 
> I'm unaware of "locate". I have been using "find". Took a quick look on 
> man pages and don't really see a difference, but I am not sure.

They're quite different but overlap to some extent. 'find' is the
reliable way of searching the current system according to a whole bunch
of criteria (man find). 'locate' just does a quick search on a database
which is updated regularly (usually nightly) by the updatedb program.
The difference is that locate is very fast, but of course it only tells
you what existed at the time the database was updated.

You really need both programs at different times.

> The one thing that sticks out is the running in a directory with a file 
> called Makefile:
> +++
> ls -l $(locate -b -i '\Makefile')
> +++
> 
> doesn't give me anything useful, just a 'ls -l' of the directory. The 
> man pages talks about "lists files in databases that match a pattern". 
> What am I missing here?

Nothing. 'locate' is just doing what it's defined to do (man locate). I
gave a quick and dirty example of how to use it, without considering the
case of directories named Makefile since they aren't that usual. You
could modify my example to skip such directories but I doubt it's worth
the effort unless this is something you're going to be doing frequently.

> Plus, I don't see a recursion option, leading me to believe that it 
> wants me to be searching something for all info rather than current pwd?

Again, 'man locate'.

> "find" give me what I want, but not with the protections et al info. 
> Tried to figure out a redirect or pipe to have everything from find go 
> into a "ls -l", but I am either missing the obvious or its more 
> complicated than I am aware of.

find <args> | xargs ls -l

or

ls -l $(find <args>)

poc

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux