Our ksh environment defines several functions. The names of these functions can be listed using then typeset -f
ksh command (or the functions
alias). Is it possible to see the definition (ie source code) for these functions?
This seems like an obvious question, but I've tried all manner of parameters to typeset -f
with no luck.
As an example (on Linux):
$ foo()
> {
> echo foo
> }
$ foo
foo
$ typeset -f foo
foo
$
For some (but not all) other functions defined by default in the environment, typeset -f
does show the source.
Update 1: This is happening with Linux kernel 2.4.21-32
Update 2: Update 2: Ctrl-V gives "Version M 1993-12-28 n+" - seems like this is quite an old version so might not have the fixes mentionned by Gilles below
Thanks, Steve
To see the source of a given function, use typeset -f <function-name>
, for example:
$ foo
foo
$ typeset -f foo
function foo
{
echo foo
}
You can also use a bare typeset -f
to see all functions and their source.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With