Listing defined functions in bash

Posted by Charles Duffy on Stack Overflow See other posts from Stack Overflow or by Charles Duffy
Published on 2010-04-12T22:03:32Z Indexed on 2010/04/12 22:53 UTC
Read the original article Hit count: 348

Filed under:
|

I'm trying to write some code in bash which uses introspection to select the appropriate function to call.

Determining the candidates requires knowing which functions are defined. It's easy to list defined variables in bash using only parameter expansion:

$ prefix_foo="one"
$ prefix_bar="two"
$ echo "${!prefix_*}"
prefix_bar prefix_foo

However, doing this for functions appears to require filtering the output of set -- a much more haphazard approach.

Is there a Right Way?

© Stack Overflow or respective owner

Related posts about bash

Related posts about introspection