get a list of function names in a shell script
Posted
by n-alexander
on Stack Overflow
See other posts from Stack Overflow
or by n-alexander
Published on 2010-04-13T15:23:23Z
Indexed on
2010/04/15
0:23 UTC
Read the original article
Hit count: 370
I have a Bourne Shell script that has several functions in it, and allows to be called in the following way:
my.sh <func_name> <param1> <param2>
Inside func_name() will be called with param1 and param2.
I want to create a "help" function that would just list all available functions, even without parameters.
The question: how do I get a list of all function names in a script from inside the script?
I'd like to avoid having to parse it and look for function patterns. Too easy to get wrong.
Thanks, Alex
© Stack Overflow or respective owner