On 03/15/2017 03:36 PM, Kai Krakow wrote: > Am Wed, 15 Mar 2017 16:31:58 +0100 > schrieb Alarig Le Lay <ala...@swordarmor.fr>: > >> On mer. 15 mars 09:10:26 2017, the...@sys-concept.com wrote: >>> Yes, I run as root: updatedb >>> But when run: >>> locate consent_extraction* >>> >>> It only list one file: >>> /home/fd/consent_extraction1.pdf (this is a link file) >>> /home/fd/business/forms/consent_extraction1.pdf >>> >>> It can not find: "consent_extraction.pdf" both files are in same >>> directory >>> >>> ll business/forms/ >>> total 688 >>> ... >>> -rw-r--r-- 1 fd fd 63032 Mar 15 08:52 consent_extraction1.pdf >>> -rw-r--r-- 1 fd fd 397649 Mar 14 20:05 consent_extraction.pdf >>> >>> I observe the same behaviour on my local machine and remote machine. >>> >>> Running "find" finds both files >>> >>> find . -name '*consent_extraction*' >>> ./business/forms/consent_extraction.pdf >>> ./business/forms/consent_extraction1.pdf >>> ./consent_extraction1.pdf >>> >>> Why? >> >> Hi, >> >> 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. > > This is a concept many people cannot or don't want to grasp. Easy fix > is to put quotation marks around the search term: > > # locate "consent_extraction*" > > Especially people coming from Windows or DOS have problems with this > feature. In the MS world, globbing expansion is done by the command > itself: it will see the * literally in the parameters. > > In the GNU world, globbing expansion is done by the shell before > handing parameters over to the command: The command won't see the * but > instead sees what the shell made from it. To work around this behavior, > you simply put quotation marks around it (which will be removed before > handed over to the command, so even consent_extraction"*" would work). > > Thus, simply always put quotation marks if you don't want to become > fooled by unwillingly letting the shell do its job. Missing to do so > can even have some negative effects, i.e. dangerous, like overwriting > files during mv by moving all files into the same filename.
locate "consent_extraction*" - didn't find anything I think, by default "locate" wants to enclose the search location between two "*.....*" stars. So if you will not put anything locate will put them for you. If you put only one star it will not find anything. -- Thelma