On Mon, Nov 25, 2024 at 9:04 PM Martin D Kealey <[email protected]>
wrote:
>
> For both ‘command -v’ and ‘command -V’, there are no combinations of
> options for ‘type’ that will produce the same output in all cases.
>
For executables, aliases, functions, built-ins, and keywords, the output of
`command -V` (capital V) is identical to the output of `type` (with no
flags). To wit:
foo() { echo hi; }
alias bar=foo
for c in foo bar bash echo for
do
a=$( command -V "$c" )
b=$( type "$c" )
[[ $a == $b ]] && echo same || echo nope
done
#same
#same
#same
#same
#same
To be clear, I have no problem with the behaviour of 'command' itself. My
report was only meant to file a bug against the doc-strings output by 'help
command'. Maybe I could suggest a starting point for a fix, using the
language from the standard linked earlier, and the output of 'help type':
> -v For each COMMAND, print a string to indicate how it would be
interpreted by the shell. The command word is printed for shell functions,
built-ins, and keywords, while a pathname is printed for executables found
in PATH. Aliases are printed with their definition.
>
> -V For each COMMAND, print a more verbose description of how it would
be interpreted if used as a command name, similar to the 'type' built-in.
- Andrew