Re: Best way to over-ride a builtin and run the "real" version from /bin
From:
microsuxx
Subject:
Re: Best way to over-ride a builtin and run the "real" version from /bin (or wherever)
Date:
Tue, 15 Jul 2025 21:52:32 +0200
prompt$ $( type -P false )
On Tue, Jul 15, 2025, 4:50 AM Greg Wooledge <greg@wooledge.org> wrote:
> 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.
>
>