Bash question

Bruce Marshall bmarsh
Mon May 17 11:59:38 PDT 2004


On Friday 20 February 2004 10:24 pm, Alan Jackson wrote:
> 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?

Yes...  that will do it and is a lot more acceptable than using quotes...   
Thanks..!


-- 
+----------------------------------------------------------------------------+
+ Bruce S. Marshall  bmarsh at bmarsh.com  Bellaire, MI         02/21/04 09:48  +
+----------------------------------------------------------------------------+
"Anticipated events never live up to expectations."



More information about the Linux-users mailing list