View Single Post
Old 08-08-2008   #4 (permalink)
Neil Chambers


 
 

Re: Script parameter problem

ahh - I think I see - you actually want unique parameters but you want to
avoid using an array to build the input argument. Yes, I see now this is
what you meant.

I have absolutely no idea how to achieve that In order for $i to
separate the parameters it must (AFAIK) be an array OR you must convert $i
into an array when you pass it through. Using a Split() wouldn't work for
the example you've given but some regular expression jiggerypokery might do
it. Sadly my regex skilz are not that great.

soz
n

"Oliver" <olli.marx@xxxxxx> wrote in message
news:uCfg5pQ%23IHA.5056@xxxxxx
Quote:

> Hi Neil,
>
Quote:

>> I'm not quite sure what you mean but each space denotes a new argument
>> (multiple spaces mean more arguments which get bundled into an array) so
>> using the approach you used to assign to $i is correct for specifying a
>> single argument
>
> That's right. But I want 'expand' $i in that way, that $i becomes the
> commandline
>
> ./test1 '1234 5678' 22 33 zzz
>
> and not
>
> ./test1 "'1234 5678' 22 33 zzz"
>
> Cheers,
> Oliver
>
Quote:

>> "Test" <olli.marx@xxxxxx> wrote in message
>> news:%23xEdbDN%23IHA.4784@xxxxxx
Quote:

>>> Hi,
>>>
>>> there are two scripts
>>>
>>> test1.ps1:
>>> > $Args
>>>
>>> test2.ps1:
>>> > $i = "'1234 5678' 22 33 zzz"
>>> > ./test1 $i
>>>
>>> Running test2 -> Output
>>> > '1234 5678' 22 33 zzz
>>>
>>> but it should be like
>>> test3.ps1:
>>> > ./test1 '1234 5678' 22 33 zzz
>>>
>>> Running test3 -> Output:
>>> > 1234 5678
>>> > 22
>>> > 33
>>> > zzz
>>>
>>> How can I use a normal string - without converting it to an array - as a
>>> variable. Or I'm totally blind?
>>
My System SpecsSystem Spec