Hacker News new | past | comments | ask | show | jobs | submit login

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.




You can do this in PowerShell also:

    get-content function:function_name
`function:` being a filesystem-like PS Provider.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: