On Fri, 04 Mar 2016 18:05:39 +0100, Martijn Dekker wrote:

> This simple patch makes the 'command' builtin POSIX-compliant and
> consistent with other current shells. It fixes two things:
> 
>    a) 'command -v' does not find shell reserved words (a.k.a. keywords).
> For instance, 'command -v select' outputs nothing but should output
> 'select'.
> 
>    b) 'command -pv' always outputs the path of an external command, even
> if 'command -p' would execute a builtin. For instance, 'command -p kill'
> executes the 'kill' builtin, as expected, but 'command -pv kill' outputs
> '/bin/kill'. The '-v' option is supposed to reflect what would actually
> be executed, so 'command -pv kill' should output 'kill'. The -p option
> sets the PATH to a default system value before doing the search, but
> that has no bearing on the fact that builtins take precedence over
> external commands.
> 
> The patch fixes both issues for 'command' without affecting the
> behaviour of the ksh-specific builtin 'whence', which is handled by the
> same C function.

This also looks fine but we should add a similar regress for whence's
-p and -v flags.

 - todd

Reply via email to