How does this work without `trap` or `PROMPT_COMMAND`?
(I think PROMPT_COMMAND will take an array of functions in later versions of Bash)
(I think PROMPT_COMMAND will take an array of functions in later versions of Bash)
(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.)
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/80a392470f8eddd70e... )