Edit: More context
I'm using Oh My Posh and Atuin with bash-preexec, all of which do something at prompt time. My example actually looks like this: 
They're set up in .bashrc like so:
eval "$(oh-my-posh init bash --config "${omp_config}")" # Get bash history number: set_poshcontext () { export _myhistcmd=$(( $(fc -l -1 | cut -f1) +1 )); } # Note the `+1`! ^^ [ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash-preexec.sh" ] && . "${HOMEBREW_PREFIX}/etc/profile.d/bash-preexec.sh" eval "$(atuin init bash --disable-up-arrow)" To @Stéphane Chazelas questions:
$ typeset -p PS{1..4} declare -- PS1="\$(_omp_get_primary)" declare -- PS2="\$(_omp_get_secondary)" -bash: typeset: PS3: not found declare -- PS4="+ " $ echo "$PROMPT_COMMAND" __bp_precmd_invoke_cmd _omp_hook __bp_interactive_mode $ trap trap -- '__bp_preexec_invoke_exec "$_"' DEBUG