In zsh 5.3 or above,
type _precmd_function_domore
should return something like
_precmd_function_domore is a shell function from /usr/local/etc/zshrc.d/80-PetaLinux
With zsh
5.4 or above, you can also use:
echo $functions_source[_precmd_function_domore]
When you run zsh
with the xtrace
option (like with zsh -x
), it writes debugging information on stderr that shows every command it runs (not function definitions though). You can modify the $PS4
variable (the prompt variable used for the xtrace
output, see info zsh PS4
) so it gives you more information like for each command that it runs, from which file and on each line the command was read from.
PS4='+%x:%I> ' zsh -x 2> >(grep precmd_func)
Would run a new zsh interactive shell instance, with stderr filtered by grep to show the lines that contain precmd_func
.
Or with zsh
, you can invoke that _precmd_function_domore
function under xtrace
and with %x:%I
in $PS4
to see where the function definition was read from:
$ grep -n precmd ~/.zshrc
192:precmd_foo() echo foo
$ (PS4='+%x:%I> '; set -x; precmd_foo)
+zsh:2> precmd_foo
+/home/stephane/.zshrc:194> echo foo
foo
(note the off-by-two line number here though).
PS4='+%x:%I> ' zsh -x 2> >(grep precmd_func)
show any output?+/usr/local/etc/zshrc.d/10-xterm:20> precmd_functions+= ( _precmd_function_dostuff)
and+/usr/local/etc/zshrc.d/80-PetaLinux:18> precmd_fucntions +=( _precmd_function_domore )
type _precmd_function_dostuff
tell you where it's defined?zshrc.d
is used for? Also, do you know what the convention/meaning for the numbers in the filenames10-xterm
and80-Petalinux
?zsh
installed on that system? Given the names, it may also be that those files are installed as part of different packages (like10-xterm
fromxterm
...)