help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way to over-ride a builtin and run the "real" version from /bin


From: Lawrence Velázquez
Subject: Re: Best way to over-ride a builtin and run the "real" version from /bin (or wherever)
Date: Mon, 14 Jul 2025 22:11:43 -0400

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?


> So it seems.  Maybe an option for this could be added to "command".

There are precedents for this in ksh93u+m's "command -x" and yash's
"command -e".


-- 
vq



reply via email to

[Prev in Thread] Current Thread [Next in Thread]