Re: scripting problem

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Eric \"Shubes\"
Date:  
To: david, Main PLUG discussion list
Subject: Re: scripting problem
David wrote:
> On Fri, 16 Feb 2007, Eric \Shubes\ wrote:
>
>> Here's a good Friday afternoon exercise for you script animals out there.
>> 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
>
> Not sure if its the same, but the below worked.
>
> ---------------
> #!/bin/sh
>
> ls "${1}"
> ls "${2}"
> ls "${3}"
> -------------------
>
> Invoked as:
> scriptname.sh "this is" a param
>
> resulted in:
>
> ls: this is: No such file or directory
> ls: a: No such file or directory
> ls: param: No such file or directory
>
>
> David


I wasn't quite clear enough I guess. Since I'm building a variable number of
parameters, I can't specify each one separately, and thus cannot use quotes
when invoking the command.

Using your example, I need to do:
argument="this is"
scriptname.sh $argument a parm
and have it come out the same as your example. I can't put the whole thing
in quotes because I have a list of arguments, some containing spaces and
some not.


--
-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