The problem is that by default, name=value pairs are only recognized when
they preceed the command name. You can use the -k startup options to allow
name=value pairs any where on the command line.
Thus,
ksh -k ./script.ksh -n 3 "${PARMS}"
should also work. The ksh -k could be embedded in script.ksh using #! on
systems that support #!.
On Mon, Oct 14, 2013 at 10:10 AM, Tom K. <[email protected]> wrote:
> Great. Thanks.
>
> The eval worked. I'll try the compound option as well.
>
> May need to run this with ksh88, so I might not be able to use compound
> vars. (Apologies. Should have mentioned earlier.)
>
> Cheers, Tom
> ------------------------------**---------------------------
>
>
> On 10/14/2013 6:48 AM, Danny Weldon wrote:
>
>> These both worked for me:
>>
>> eval ./script.ksh -n 3 "${PARMS}";
>> eval ./script.ksh -n 4 $PARMS;
>>
>> On 14 October 2013 13:25, Cedric Blancher <[email protected]>
>> wrote:
>>
>>> On 14 October 2013 04:59, Tom K. <[email protected]> wrote:
>>>
>>>> Hey Gents,
>>>>
>>>> When trying to pass a variable of paramters to another script, to reduce
>>>> amount of code:
>>>>
>>>> OPT1="This is my Option";
>>>> OPT2="/folder/file";
>>>> PARMS="-u \"me\" -J \"$OPT1\" -g \"$OPT2\"";
>>>>
>>>> then passing it in like this:
>>>>
>>>> ./script.ksh -n 1 "$PARMS";
>>>>
>>>> I get this:
>>>>
>>>> UARG=| "me" -J "This is my Option" -g "/folder/file"|
>>>>
>>>> Or I get this:
>>>>
>>>> UARG=|"me"|
>>>>
>>>> when I try to pass it in this manner:
>>>>
>>>> ./script.ksh -n 2 ${PARMS};
>>>>
>>>> Looks like it manages to grab a part of what's in $PARMS but not the
>>>> rest of
>>>> the string. Was curious about this behaviour and if KSH had any way to
>>>> make
>>>> this work? Full code is below. Tried a couple of variations including
>>>> '
>>>> but no luck. This is an older KSH93 version. I don't have the option
>>>> of
>>>> changing this version unfortunately.
>>>> # echo ${.sh.version}
>>>> Version M 93t+ 2009-05-01
>>>>
>>> Does read -C work in ksh93t+?
>>>
>>> if it does then you could pass complex data via compound variables,
>>> i.e. print compound variable via print -C and read the data into
>>> another shell instance through read -C.
>>>
>>> Ced
>>> --
>>> Cedric Blancher <[email protected]>
>>> Institute Pasteur
>>> ______________________________**_________________
>>> ast-users mailing list
>>> [email protected].**com <[email protected]>
>>> http://lists.research.att.com/**mailman/listinfo/ast-users<http://lists.research.att.com/mailman/listinfo/ast-users>
>>>
>>
>>
>>
> ______________________________**_________________
> ast-users mailing list
> [email protected].**com <[email protected]>
> http://lists.research.att.com/**mailman/listinfo/ast-users<http://lists.research.att.com/mailman/listinfo/ast-users>
>
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users