Something else you can do with BASH functions is use:
declare -f function_name
to print out the contents of a function, in a format that can be directly evaluated with command substitution. This is useful if you want to send a function (or a number of functions) into another BASH instance (such as via an SSH connection).
A google search for "RPC in Bash" will take you to a GIST I put up on Github a while back that gives details of how this works.
You can do this in ksh93 also, I believe you use typeset -f instead of declare -f.
A google search for "RPC in Bash" will take you to a GIST I put up on Github a while back that gives details of how this works.
You can do this in ksh93 also, I believe you use typeset -f instead of declare -f.