In ksh93 typeset -f lists all functions and its definition.

$ f(){ :; }

$ typeset -f
f(){ :; }

With the added quirk that functions that have been defined without a trailing newline are listed the same way:

$ g(){ :; }; h(){ :; }
$ k(){ :; }

$ typeset -f
f(){ :; }
g(){ :; };h(){ :; }
k(){ :; }

Is there a way to list all function names, better if one per line ?

Failing that: Is there a way to break such definitions into separate lines ?
I mean: Without doing all the shell parsing to find the function end (or start).

I hope to be able to do typeset -f functionname for every function defined in the present script running environment.

1 Answer 1


Found a solution in the manual:

$ typeset +f

If +f is specified, then a line containing the function name followed by a shell comment containing the line number and path name of the file where this function was defined, if any, is displayed.

You must log in to answer this question.