[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: doc-strings of the 'command' built-in, as output by help
From: |
Andrew Davis |
Subject: |
Re: doc-strings of the 'command' built-in, as output by help |
Date: |
Tue, 26 Nov 2024 13:39:00 -0500 |
On Mon, Nov 25, 2024 at 9:04 PM Martin D Kealey <martin@kurahaupo.gen.nz>
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
- doc-strings of the 'command' built-in, as output by help, Andrew Davis, 2024/11/25
- Re: doc-strings of the 'command' built-in, as output by help, Chet Ramey, 2024/11/25
- Re: doc-strings of the 'command' built-in, as output by help, Martin D Kealey, 2024/11/25
- Re: doc-strings of the 'command' built-in, as output by help, Oğuz, 2024/11/25
- Re: doc-strings of the 'command' built-in, as output by help,
Andrew Davis <=