0

This question already has an answer here:

On MacOS, the default bash on the OS is 3.2.

If I run help trap it says that if the signal_spec is DEBUG, that the command is run after each command, but the bash manpage says it is run before each command. The actual behavior of this bash agrees with the manpage (i.e. before the command).

I downloaded the source of 4.4.18(1) and built it. Both the manpage and help trap say that the trap is executed before each command. However, even then, the text of each of those pieces of documentation are slightly different.

So my naive assumption that the help builtin reads/parses the manpage is clearly incorrect.

So where does help get its info that it relays to the user?

marked as duplicate by muru, Jesse_b, Rui F Ribeiro, Anthony Geoghegan, Jeff Schaller May 31 '18 at 22:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Ahh, it's baked into the executable after a few levels of source generation.

http://git.savannah.gnu.org/cgit/bash.git/tree/builtins/trap.def?id=b0776d8c49ab4310fa056ce1033985996c5b9807#n25

So the various builtin definition files have the documentation in them which gets converted into builtins.c by mkbuiltins.

I guess the MacOS bash manpages were updated to reflect the correct behavior of trap in with a DEBUG signal_spec whereas the definition source was not updated and the executable rebuilt.

Not the answer you're looking for? Browse other questions tagged or ask your own question.