Re: scripting problem

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Eric \"Shubes\"
Date:  
To: Main PLUG discussion list
Subject: Re: scripting problem
Alex LeDonne wrote:
> On 2/16/07, Eric Shubes <> wrote:
>> 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?
>
> One option I found playing with it:
> /bin/sh -c "/path/to/command $arglist"
>
> What shell are you using?


bash

> Mine doesn't have $? at all when invoked as /bin/sh.


Sorry about that, I was a bit too quick composing. $? is the return code, I
meant to type $#, which is the number of arguments.

>
> -A




--
-Eric 'shubes'
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss