It is currently Wed, 01 Oct 2014 03:12:17 GMT



 
Author Message
 FPATH function calls in ksh script
Can someone remind me how to setup and call functions using FPATH in
ksh?


 Fri, 13 Apr 2001 03:00:00 GMT   
 FPATH function calls in ksh script
FPATH should be set to the directory in which you will have your
ksh functions defined.  Now, in your .profile you simply need
to mention that it exists, and the shell will search your FPATH for
the function definition when it is needed (executed/called).  Makes
logging in much faster.

Deepak



 Sat, 14 Apr 2001 03:00:00 GMT   
 FPATH function calls in ksh script
In article <36355630.D1F19...@deepak.net>,

One should point out that the file name must match the function
name. FPATH processing occurs after PATH processing.  If no match
fo a command has been found after PATH processing,  the FPATH is
consulted.  If a readable (not necessarily executable) file is
located in the FPATH whose name matches the command name,  the
file will be sourced and then the command  executed as a
function.  So the file must contain the function definition:

function tt
{
...

Be careful what goes in the file and be very careful about the file's
and the directory's permissions.  For instance,  you can:

echo "Loading tt"

function tt
{
...

You can even create local functions that are used by the function you call:

################  file tt ################
function tt
{
echo tt start
tt_1
tt_2
echo tt end
unset -f tt tt_1 tt_2

function tt_1
{
echo tt_1 start

function tt_2
{
echo tt_2 start
################  file tt ################

Opinions expressed herein are my own and may not represent those of my employer.



 Sat, 14 Apr 2001 03:00:00 GMT   
 
   [ 3 post ] 

Similar Threads

1. AIX 432 - ksh -x option when script calls another script

2. ksh: FPATH

3. ksh question about FPATH

4. FPATH taking effect but functions not properly invoked

5. Browser calls CGI C function which sets an env var and call a c function crashes

6. calling library functions from ksh

7. ksh Menu driven interface problem w/ function call

8. calling library functions from ksh

9. Calling functions written in BASH from KSH?

10. Debuggin ksh script function


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software