3 ms·
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 e
by derekp7 8y ago
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.
- jodrellblank 8y agoYou can do this in PowerShell also: get-content function:function_name `function:` being a filesystem-like PS Provider.