... and:

   function testing
   {
       print "Testing ..."
       eval $1=12
   }

works well (i.e., as advertised).

Thanks.
---John

On Wed, Apr 10, 2013 at 1:22 AM, John Chludzinski
<[email protected]> wrote:
> Interesting, when I tried:
>
>   #!/bin/mksh
>
>   P=0
>   function test
>   {
>       print "Testing ..."
>       $1=12
>    }
>    test    P
>    print "P = $P"
>
>    exit 0
>
> I got:
>
>    Testing ...
>    test: ./t.ksh[9]: P=12: not found
>    P = 0
>
> So test() is being run?  When I changed the function name to "testing" I got:
>
>    Testing ...
>    testing: ./t.ksh[9]: P=12: not found
>    P = 0
>
> ---John
>
> PS> I'm a newbie here and "test" is so infrequently used in lieu of
> [...] or [[...]] that the oversight here is understandable.
>
> On Tue, Apr 9, 2013 at 5:36 PM, Thorsten Glaser <[email protected]> wrote:
>> Seb dixit:
>>
>>>Le Tue, 9 Apr 2013 13:45:25 -0400
>>>John Chludzinski a écrit:
>>
>>>>    function test
>>
>> Do *not* overwrite builtins with custom function names.
>> The manpage has a list of such names; test is among them.
>>
>>>Maybe "eval $1=12" is what you are looking for in test(). :)
>>
>> Asides from test() never being run, that too, yes.
>> Thanks for jumping in while I was out ;-)
>>
>> bye,
>> //mirabilos
>> --
>> Sorry,  I’m annoyed today and you came by as an Arch user. These are the
>> perfect victims for any crime against humanity, like  systemd,  feminism
>> or social democracy.
>>                 -- Christoph Lohmann on [email protected]

Reply via email to