
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.