How to show zsh function definition (like bash “type myfunc”)?

The zsh idiom is whence, the -f flag prints function definitions:

zsh$ whence -f foo
foo () {
    echo hello
}
zsh$

In zsh, type is defined as equivalent to whence -v, so you can continue to use type, but you’ll need to use the -f argument:

zsh$ type -f foo
foo () {
    echo hello
}
zsh$

And, finally, in zsh which is defined as equivalent to whence -c – print results in csh-like format, so which foo will yield the same results.

man zshbuiltins for all of this.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)