scripting problem
Eric "Shubes"
plug at shubes.net
Fri Feb 16 14:26:08 MST 2007
Here's a good Friday afternoon exercise for you script animals out there.
I've been working on my 'mansfor' script, and am hung up with just one item,
so I'm seeking help from the best place I know of. ;) I'll try to describe
it in generic terms in order to keep it simple. Perhaps in describing it
I'll realize what my problem is. Then again, probably NOT.
I'm invoking a command from a shell script. The command takes multiple
parameters, which I'm building on the fly, simply using environment
variables to specify the parameters. So far so good.
My problem crops up when one of the parameters (a description) contains
spaces (I've sidestepped the problem for the moment by translating the
spaces to "_", but I'd like to keep the spaces in there). When the command
is executed, the shell (rightly so) see the space and terminates the
argument. This is typically solved by including the parameter in quotes.
I've tried including the quotes in the variable, but I can't seem to get the
shell to treat what's inside of the quotes as a single argument to the command.
For example,
$ arglist="parm1 \"this is parm2\" parm3"
$ command $arglist
command receives:
$?=5 $1=parm1, $2="this, $3=is $4=parm2" $5=parm3
What I want command to receive is:
$?=3 $1=parm1, $2=this is parm2, $3=parm3
How can I accomplish this?
TIA
--
-Eric 'shubes'
More information about the PLUG-discuss
mailing list