shell scripts and comand arguments

Frank Shute frank at esperance-linux.co.uk
Sun Jun 1 23:54:36 BST 2003


On Sun, Jun 01, 2003 at 02:53:11PM +0100, 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?

Well, you definitely have to do it another way :)

2 suggestions to try:

title=$list" archive"

which may or may not work.

or:

args="-title \"$list archive\" -add . -outdir ."

which I think will, & is better IMO. I don't see there being any future
in assigning a (presumably) unchanging string (" archive") to a variable.

-- 

 Frank 

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

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






More information about the Ukfreebsd mailing list