man <command> doesn't always point to the "right" (as in "given by which <command>"). Is there a way to make sure (or at least increase the chances that) I get docs that correspond to the command that will actually be executed?
EXAMPLE
With pack (a wads script) I get this:
$ which pack
.../dev/unix_scripts/pack
$ man pack LIBPACK(3)
NAME
libpack - support for connected components
...
Note that here .../dev/unix_scripts/pack doesn't actually have a man page, so I'd like the man to tell me it doesn't find it.
TRIED
If man took full paths to executable, I could do this:
$ which pack | man
This:
$ man 1 pack
No entry for pack in section 1 of the manual
but I'm not sure only looking in section 1 ("Executable programs or shell commands") is too restrictive.
General context
The underlying context is that I'm trying to write a (python) function that will get me some info on any "valid" (in the sense of which <command>) executable. A name is linked to a unique executable through which. How do I get docs-like information about that executable?
I (post my question on stackoverflow)[https://stackoverflow.com/questions/73814043/universal-help-for-terminal-commands], which was banished as "not a software question", so I reduced the question and posted it here.
MANPATH. (Readman man.) Distros often package symlinks to manpages, effectively creating "aliases". If you don't want the specific manpage to be displayed when you supply a specific argument to man(1), you will need to organize (move/remove) manpages or symlinks to manpages yourself, including configuring your package manager to not undo your changes on next update.