Bash question

Alan Jackson ajackson
Mon May 17 11:59:37 PDT 2004


On Fri, 20 Feb 2004 20:11:33 -0500
Bruce Marshall <bmarsh at bmarsh.com> wrote:

> On Friday 20 February 2004 08:03 pm, Alan Jackson wrote:
> > On Fri, 20 Feb 2004 18:41:28 -0500
> >
> > Bruce Marshall <bmarsh at bmarsh.com> wrote:
> > > I'm trying to write a bash script that uses the 'find' command.  I want
> > > to pass it a wild-card argument like   *.jpg
> > >
> > > The argument always does the file expansion thing like it is supposed
> > > to.... but is there a way to pass such an argument without having the
> > > expansion take place?
> > >
> > > Done my homework, reading the manual, trying various things out....  no
> > > joy.
> >
> > Here's a script I run that does that... in fact it does a number of stupid
> > find tricks...
> >
> 
> <snip of nice script file>
> 
> Nice, but I don't see anywhere in there where you pass it a wildcard argument 
> such as  *.jpg.
> 
> Did I miss it?

I missed the "pass it" part. Gotta be more careful....

try this :

-----8<----- cut me --------
#!/bin/sh

echo "$1"
find . -name "$1" -print
-----8<----- cut me --------

and call it via

testme \*jpg

Is that what you wanted?

-- 
-----------------------------------------------------------------------
| Alan K. Jackson            | To see a World in a Grain of Sand      |
| alan at ajackson.org          | And a Heaven in a Wild Flower,         |
| www.ajackson.org           | Hold Infinity in the palm of your hand |
| Houston, Texas             | And Eternity in an hour. - Blake       |
-----------------------------------------------------------------------


More information about the Linux-users mailing list