function

How can i invoke a function from the shell. ex lspath is the name of the function but when i try $ lspath from the command prompt i get /bin/ksh: lspath: not found. I have put the lspath in to my .profile as in export lspath. it is not working. please help

It is difficult to understand what you want, but check the following:
1) It seems that 'lspath' executable does not exist or is not in your $PATH.
2) If you are running this from something like CRON then your ~/.profile is not evaluated before execution

you can just call lspath itself.
The function definition should be at the begining of the script
eg:-

#!/usr/bin/ksh
# program starts here
lspath()
{

...
...

}

lspath

# program ends here

It seems to work. After I execute the file. but I still can not use the lspath function from the command prompt. ex $ lspath don't work. But thank you

I don't know what you really want to do (I don't understand why you want to write a function for command line usage ) but it seems to me you'd be better off removing the function tags and putting the scripts in your path (/usr/bin/local, for example).

Further, given the name of this function, I'm guessing you'd probably be even in better shape just using an alias in your .profile .

Double post.....

Hello,

You can not call the function from the command prompt.
The lspath function can be called from your shell script.

Regards,
Thobias Vakayil

Maybe you wanted this? (execute given commands):

print "function lspath { print 'I am a lspath!!';return 0; }" >script.ksh
chmod +x script.ksh
. ./script.ksh

lspath