3 ms·
zsh has some special handling if you define functions with magic names: https://zsh.sourceforge.io/Doc/Release/Functions.html#Hook-Functions https://zsh.sourcef
by wolfgang42 3y ago
zsh has some special handling if you define functions with magic names: https://zsh.sourceforge.io/Doc/Release/Functions.html#Hook-Functions https://zsh.sourceforge.io/Doc/Release/Functions.html#Hook-F...
(I apparently knew this when I wrote the above code, since on closer inspection it doesn’t actually match the gist my comments claim it came from, but I have to admit I had since forgotten it.)
- pmarreck 3y agoRight, but I was asking about Bash, where this worked unchanged on my Mac... I do actually have something installed in my env, I think, that might trigger those functions automatically if they exist, now that I think about it... bash> v PROMPT_COMMAND PROMPT_COMMAND is an indexed array variable declare -a PROMPT_COMMAND=([0]=$'__bp_precmd_invoke_cmd\nmcfly_prompt_command;_direnv_hook\n:' [1]="__bp_interactive_mode") (pretty sure that this broke when I tried to force it to be a pure array instead of a 2 element array with the first as a concatenation of functions... unfortunately) ("v" is a "view/show" function I wrote that allows me to see the definition of anything; https://github.com/pmarreck/dotfiles/blob/80a392470f8eddd70ef072799b6812863513affa/bin/functions/show.sh#L72 https://github.com/pmarreck/dotfiles/blob/80a392470f8eddd70e... )