Function name in ksh

Function name in ksh

Post by Alex Robinso » Thu, 25 May 2000 04:00:00



I have an alias setup for my ksh which is defined as follows :


This works fine.

However, we are moving our GNU software and it is in different places
depending on what OS Platform you are on. Therefore, I need some logic for
this alias. I have not been able to figure this out with an alias so I tried
defining a function. I now get the following message :



allowed? I've looked in man pages and see no limitations noted for function

function?

--
Regards,
Alex Robinson

 
 
 

Function name in ksh

Post by Matthew Land » Thu, 25 May 2000 04:00:00



> I have an alias setup for my ksh which is defined as follows :


> This works fine.

> However, we are moving our GNU software and it is in different places
> depending on what OS Platform you are on. Therefore, I need some logic for
> this alias. I have not been able to figure this out with an alias so I tried
> defining a function. I now get the following message :



> allowed? I've looked in man pages and see no limitations noted for function

> function?

Certain parameters mean special things to a function or a program.  An

really worry about the usage of them.  The function sees those special
characters so cannot be used in other ways.  Try to use a character that
doesn't have special meaning to a script/function.

 - Matt

 
 
 

1. Passing the name of an array to a function in KSH

Hi all,

I need to populate an array whose name I pass into a function (as I
need to populate several arrays with the same function)

So i want to do:

function f_fillarray     # takes a string for array name
{
        loop
        do
                # Get a value
                $1[$i]="value"        

# this line above should put the text "value" into a slot in the array
whose *name* is strArrayName i.e. should be expanded to
strArrayName[$i]="value"

                i++
        done

f_fillarray "strArrayName"  # Call function with name of array to be
filled

Any ideas?

Thanks

Mark

2. No buffer space available ???

3. ksh, functions and named parameters

4. CD ROM

5. How does one include a / character in alias or function name in ksh on SVR4?

6. Numbering lines in a file..

7. ksh head ache - here doc within a ksh function

8. Need good routed - RIP V2 and/or OSPF - suggestions?

9. ksh -x does not work on function inside a function

10. What's 'side effects' of Ksh built-ins?

11. Name of the function/script that called the actual function?

12. bash [ function name same as command name ]