shell scripts and comand arguments

Frank Shute frank at esperance-linux.co.uk
Mon Jun 2 17:14:16 BST 2003


On Mon, Jun 02, 2003 at 10:57:02AM +0100, Jonathan Belson wrote:
>
> On Monday 02 June 2003 10:15 am, Frank Shute wrote:
> > On Mon, Jun 02, 2003 at 09:07:32AM +0100, John Rochester wrote:
> > > You need sh to pass this through another parsing stage to catch the
> > > quotes.
> > >
> > > Change the final line to
> > >
> > >     eval mhonarc "$args"
> > >
> > > and it should work.
> 
> And it does, cheers for that.  I did experiment with eval but I obviously
> didn't quite get it right.
> 
> > The way Jonathan wrote it, it seems to work, & the way I wrote it, it
> > seems to work:
> >
> > $ ./test
> > -title "freebsd-ports archive" -add . -outdir .
> >
> > but the way you wrote it gives me:
> >
> > $ ./test
> > -title freebsd-ports archive -add . -outdir .
> 
> This confused me too - the thing is that the way its printed isn't how
> the arguments are passed to the program :-)  In the latter case,
> 'freebsd-ports archive' /is/ passed as a single string argument
> even though it's not in quotes when you print it.

I wonder what you do if you want the quotes. Glad that John came up
with the solution.

> 
> > Could it be less to do with the shell & more to do with how mhonarc
> > itself handles commandline args? (Which is probably a perl thing,
> > having had a brief look at it's Makefile)
> 
> I thought it was Perl's fault  at first, but the same thing happened using
> other commands, too.

One day I'll get my head around all this shell weirdness. ATM, I just
tend to iterate through everything I can think of until something
works ;)

> 
> Cheers,
> 

Regards,

-- 

 Frank 

*-*-*-*-*-*-*-*-*-*-*
   Boroughbridge.
 Tel: 01423 323019
     ---------
PGP keyID: 0xC0B341A3
*-*-*-*-*-*-*-*-*-*-*

http://www.esperance-linux.co.uk/

  Call yourself a computer professional? Congratulations. You are 
  responsible for the imminent collapse of civilization.
  
     - Michael Bacarella




More information about the Ukfreebsd mailing list