Re: Best way to over-ride a builtin and run the "real" version from /bin
From:
Greg Wooledge
Subject:
Re: Best way to over-ride a builtin and run the "real" version from /bin (or wherever)
Date:
Mon, 14 Jul 2025 22:49:21 -0400
User-agent:
Mutt/1.10.1 (2018-07-13)
On Mon, Jul 14, 2025 at 22:11:43 -0400, Lawrence Velázquez wrote:
> On Mon, Jul 14, 2025, at 6:10 PM, Stan Marsh wrote:
> >> > I thought this was done using "command", like:
> >> >
> >> > $ command false --help
> >> >
> >> > but that still runs the builtin.
> >
> >> "command" only suppresses shell function lookup, not builtins or alias
> >> expansions.
>
> But since the arguments to "command" aren't in command position,
> they don't undergo alias expansion anyway, unless you do something
> like this:
>
> $ alias foo='echo foo'
> $ command foo
> bash: foo: command not found
> $ alias command='command '
> $ command foo
> foo
>
> Am I overlooking something?
That looks about right. Someone, somewhere, has probably aliased command
to 'command ' specifically so that they can have more alias expansions.