functions, autoload

display or modify KornShell functions 

KornShell Built-in


SYNOPSIS

functions [-tux] [name] [name]...

autoload name...


DESCRIPTION

functions lets you modify the attributes of the functions specified by the list of names in the command line. It is a built-in alias of sh defined with

alias functions='typeset -f'

If no function names are specified, functions displays all currently defined functions with the attributes specified by the options. If no options are given, functions lists all currently defined functions.

autoload informs the shell that the specified functions are undefined. It is a built-in alias of sh defined with

alias autoload='typeset -fu'

and thus equivalent to functions -u

When you try to execute an undefined function called funcname, the directories specified by the FPATH environment variable are searched directory by directory for a script named funcname.ksh or if that is not found, a script named funcname. If such a script is found, it is executed in the current shell environment. Once that script has executed, the function funcname, whose definition should have been included in the executed script, is now executed. If the function funcname is still undefined, an error results.

Options

-t 

turns on the xtrace option for the given functions. See set and gset.

-u 

allows you to specify attributes for functions which are not yet defined.

-x 

marks a function for automatic export. See export.


ENVIRONMENT VARIABLES

FPATH 

contains a semicolon-separated list of directories to search for function definitions when an undefined function is executed.

Additionally, if this variable is defined and a PATH search fails to locate a command named cmdname, the directories specified in this variable are searched directory by directory for a space named cmdname.ksh or if that is not found, a script named cmdname. If such a script is found, it is executed in the current shell environment. Once that script has executed, the function cmdname, whose definition should have been included in the executed script, is now executed. If the function cmdname is still undefined, an error results.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

The number of invalid names specified on the command line.


PORTABILITY

Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.

On UNIX systems, functions is built into the KornShell but not the Bourne Shell.


NOTE

This is an alias built into the MKS KornShell.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Integrity


SEE ALSO

Commands:
export, gset, set, sh, typeset


PTC MKS Toolkit 10.1 Documentation Build 15.