shell scripts and comand arguments

John Rochester john at jrochester.org
Mon Jun 2 09:07:32 BST 2003


On Sunday, Jun 1, 2003, at 14:53 Europe/London, Jonathan Belson wrote:

> Hiya
>
>
> I was making some tweaks to a script I wrote to 'mhonarc' freebsd-*
> mailing lists, when I ran into a problem with substitutions.  Here's
> an example:
>
>
> list="freebsd-ports"
> title="$list archive"
> args="-title \"$title\" -add . -outdir ."
> mhonarc $args
>
>
> $args expands to
>
> 	-title "freebsd-ports archive" -add . -outdir .
>
> which is what you'd expect, but mhonarc sees
>
> 	-title "free-ports
>
> followed by
>
> 	archive"
>
> which confuses it no end.
>
> Is there a simple solution to this problem or must I do it another way?

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.

John





More information about the Ukfreebsd mailing list