[Gllug] Re: find mystery

Ryland, Peter peter.ryland at squaregain.co.uk
Thu May 4 09:59:52 UTC 2006


On Thu, 2006-05-04 at 09:52 +0000, Craig Millar wrote:
> On 04/05/06 10:47 +0100, Paul M wrote:
> > On 04/05/06, Craig Millar <gllug at craigmillar.org> wrote:
> > >I'm having trouble with find, as demonstrated:
> > 
> > quote the wildcard:  "*.jpg"
> 
> Thanks Paul and Martin, that works. But any idea why it works without quotes 
> in other folders? What could be tripping it up? There's no "*.jpg" files in
> the Documents folder with unusual names/characters/spaces. Bah. Confused.

The *.jpg is matched by the shell prior to running the find command, so
files in the local directory will make a difference.  For example:

$ find . -name \*.jpg
./t/3.jpg
./t/t/3.jpg
./t/t/4.jpg
./1.jpg
./2.jpg
$ find . -name *.jpg     # expands to find . -name 1.jpg 2.jpg
find: paths must precede expression
Usage: find [-H] [-L] [-P] [path...] [expression]
$ cd t
$ find . -name \*.jpg
./3.jpg
./t/3.jpg
./t/4.jpg
$ find . -name *.jpg     # expands to find . -name 3.jpg
./3.jpg
./t/3.jpg

Pete


*****************************************************************************
This communication is confidential and is intended solely for 
the use of the individual or entity to whom they are addressed. 
If you are not that person you are not permitted to make use of 
the information and you are requested to notify 
postmaster at squaregain.co.uk immediately that you have 
received it and then destroy the copy in your possession. 
Squaregain Ltd is authorised and regulated by the 
Financial Services Authority and is a member of the LSE.
******************************************************************************

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list