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

Re: locate question



On Wed, Nov 08, 2023 at 05:16:26PM +0100, tomas@tuxteam.de wrote:
> On Wed, Nov 08, 2023 at 11:45:30AM -0400, Roy J. Tellason, Sr. wrote:
> > On Tuesday 07 November 2023 11:32:21 am gene heskett wrote:
> > > so locate isn't working as I think it should.
> > > try find but it finds the whole my whole local net:
> > > gene@coyote:~$ find .scad .  |wc -l
> > > find: ‘.scad’: No such file or directory
> > 
> > Try putting a * before the period in that find command?
> 
> No, it is more than that. [...]

> Putting a * in front of it would get expanded *by the
> shell* (not by find), as was discussed elsewhere in this
> thread. Find would see the expanded result, so, if e.g.
> you have foo.scad, bar.scad and baz.scad in your current
> dir, the command actually run would be
> 
>   find foo.scad bar.scad baz.scad

Also note that there are *two* periods in Gene's original find command.
He's asking find to look for stuff, beginning in ".scad" and then also
beginning in ".".

If you changed it to

    find *.scad .

then it would ask find to look for stuff beginning in "foo.scad" and
also beginning in "bar.scad" and also beginning in ".".

Changing it to

    find '*.scad' .

would ask find to look for stuff beginning in "*.scad" (a literal
asterisk character) and then also beginning in ".".  That's still not
what's wanted.

What's wanted was already posted earlier, but just for redundancy:

    find . -iname '*.scad'

is probably the best answer.  You can use -name instead of -iname if
you want the matching to be case sensitive.


Reply to: