Re: Quoting Problems for Shell Script

From: Michael Tosch (eedmit_at_NO.eed.SPAM.ericsson.PLS.se)
Date: 01/21/05


Date: Fri, 21 Jan 2005 19:07:25 +0100

Tony George wrote:
> Hi,
>
> I'm having some problems figuring out quoting for a Bourne shell script on
> Solaris 8. It's a pretty basic script and I'm probably missing something
> obvious:
>
> ---
> #!/bin/sh
>
> cmd="make $@"
>
> $cmd
> ---
>
> I want to pass the script the following options: testscript
> "DEBUGFLAGS=-DTEST1 -DTEST2"
>
> It has problems with the second parameter (i.e. -DTEST2). The whole
> DEBUGFLAGS parameter is not getting sucked in whole. If I just put the make
> command straight in the script instead of calling it from a variable,
> everything is fine. However, I would like to have the actual command in the
> variable so that I can use it in other parts of the script (e.g. logging
> info, etc...).
>
> Here are the options I've already tried with no success:
>
> testscript \"DEBUGFLAGS=-DTEST1 -DTEST2\"
>
> testscript DEBUGFLAGS=\"-DTEST1 -DTEST2\"
> testscript \'DEBUGFLAGS=-DTEST1 -DTEST2\'
>
> Any help would be greatly appreciated! My apologies if this has already
> been answered recently (I couldn't find it in the FAQ).
>
> TG
>
>

You are the 3rd now with the same solution, see previous postings:

cmd='make "$@"'
eval "$cmd"

But why not simply

cmd='make'
$cmd "$@"

-- 
Michael Tosch @ hp : com


Relevant Pages

  • Quoting Problems for Shell Script
    ... I'm having some problems figuring out quoting for a Bourne shell script on ... I want to pass the script the following options: testscript ... command straight in the script instead of calling it from a variable, ...
    (comp.unix.shell)
  • Re: sunmanagers Digest, Vol 28, Issue 14
    ... I have an V65x server x86 base, how do I format this box? ... I inser a solaris 9 cd and boot up try to do stop a so I can boot from ... need script to measure system performance. ... Moving a disk from SPARC to x86 ...
    (SunManagers)
  • RE: Telnetd exploit for solaris
    ... Subject: Telnetd exploit for solaris ... > You owe script kiddies... ... The computer and software industries owe script kiddies NOTHING. ...
    (Vuln-Dev)
  • Re: Massive Memory Structures
    ... (Solaris on sparc, Solaris on x86_64) ... script, I get an out of memory error and the script dies. ... what options do I need to compile in to make this happen. ... It will create a 5g test file, ...
    (comp.lang.perl.misc)
  • Re: syslog to send msg to last user in printer queue
    ... >Where boven1 is the printername in Solaris. ... of Solaris that deliver each print job to the printer. ... own printer interface script. ...
    (comp.unix.solaris)