On 15/03/2017 18:03, the...@sys-concept.com wrote:
> On 03/15/2017 09:51 AM, the...@sys-concept.com wrote:
> [snip]
>>>
>>> Do you have file consent_extraction1.pdf in your working directory? In
>>> that case, your shell will begin by expending your asterisk and you will
>>> really look for consent_extraction1.pdf.
>>
>> It is a strange behaviour :-/
>> Yes, I had a link "consent_extraction1.pdf" in a working directory and
>> locate could only locate: consent_extraction1.pdf
>> It could not find: consent_extraction.pdf
>>
>> When I removed "consent_extraction.pdf" from my working directory.
>> run "updatedb" and
>> "locate *consent_extraction*" found both files
>> "locate consent_extraction" found both files
>> "locate consent_extraction*" didn't find any files
>>
>> The "*" is is messing up the search. I was under impression the "*" will
>> match any character including extensions.
>>
>> --
>> Thelma
> 
> Sometimes reading the "man" files helps :-/
> 
> ...If --regex is not specified, PATTERNs can contain globbing
> characters.  If any PATTERN contains no globbing characters, locate
> behaves as if the pattern were *PATTERN*.

And none of that matters as the shell will expand the globs before
locate even sees it at all. Unless you go to extra measures with quotes.

But the whole exercise is completely unnecessary as locate by default
does partial matches. This always does what you want:

locate consent_extraction



-- 
Alan McKinnon
alan.mckin...@gmail.com


Reply via email to