shell scripts and comand arguments

Jonathan Belson jon at
Mon Jun 2 10:57:02 BST 2003

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.

> 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.



More information about the Ukfreebsd mailing list