
Try using eval around the command: COMMAND='program --debug --make-maker=--make-maker="INSTALLDIRS=vendor INSTALLMAN1DIR=none INSTALLMAN3DIR=none" --no-sign' eval $COMMAND You need bash to re-evaluate those quotes so it understands it should be one argument. Jobst On Wed, May 02, 2012 at 04:49:07PM +1000, Chris Samuel (chris@csamuel.org) wrote:
Hi folks,
I'm banging my head against how to properly pass a list of arguments in a variable through to a command in bash where the list of arguments itself has quoted values in it.
Here's a test case script:
$ cat odd-quoting.sh #!/bin/bash
a='
echo cpan2rpm $a
If I run that script with dash on Ubuntu it looks fine:
$ sh -x odd-quoting.sh + a=--debug --make-maker=--make-maker="INSTALLDIRS=vendor INSTALLMAN1DIR=none INSTALLMAN3DIR=none" --no-sign + echo cpan2rpm --debug --make-maker=--make-maker="INSTALLDIRS=vendor INSTALLMAN1DIR=none INSTALLMAN3DIR=none" --no-sign [...]
But if I run it with bash on either Ubuntu or my actual target, RHEL6, it gets it wrong:
$ bash -x odd-quoting.sh + a='--debug --make-maker=--make-maker="INSTALLDIRS=vendor INSTALLMAN1DIR=none INSTALLMAN3DIR=none" --no-sign' + echo cpan2rpm --debug '--make-maker=--make-maker="INSTALLDIRS=vendor' INSTALLMAN1DIR=none 'INSTALLMAN3DIR=none"' --no-sign [...]
I get the same problem if I run bash from its /bin/sh symlink on RHEL6.
Any ideas what I'm missing here ?
cheers, Chris -- Chris Samuel : http://www.csamuel.org/ : Melbourne, VIC _______________________________________________ luv-main mailing list luv-main@luv.asn.au http://lists.luv.asn.au/listinfo/luv-main
-- Time flies like the wind. Fruit flies like a banana. | |0| | Jobst Schmalenbach, jobst@barrett.com.au, General Manager | | |0| Barrett Consulting Group P/L & The Meditation Room P/L |0|0|0| +61 3 9532 7677, POBox 277, Caulfield South, 3162, Australia