Differences between revisions 8 and 9
Revision 8 as of 2022-06-11 15:15:28
Size: 1630
Editor: ormaaj
Comment: Nuke. Create new outline
Revision 9 as of 2022-06-11 16:37:18
Size: 1471
Editor: ormaaj
Comment: calling a function section not really necessary (I think)
Deletions are marked like this. Additions are marked like this.
Line 52: Line 52:
=== Prioritize calling a function ===

{{{#!highlight bash
}}}

See [[BashFAQ/080|FAQ #80]] for more discussion of using functions instead of aliases.

How to ignore aliases, functions, or builtins when running a command?

functions, builtins, external utilities, and aliases can all be defined with the same name at once. It's sometimes necessary specify which of these the shell should resolve while bypassing the others.

Bypass aliases

Resolve commands normally ignoring aliases:

\name

\unalias name
name

Clear all aliases:

\unalias -a

Alias expansion in bash is disabled by default in non-posix mode.

Prioritize calling a builtin or external command

Bypass aliases and functions:

\command name

If PATH is unknown / unreliable:

   1 \command -p -- name "${args[@]}"

The remainder of this FAQ assumes alias expansion has been disabled or otherwise mitigated.

Prioritize calling only a builtin

   1 # Strictly bash-only. Not recommended
   2 
   3 function my_builtin {
   4     builtin my_builtin "$@"
   5 }

Call an external utility by PATH resolution, bypassing builtins and/or functions

   1 "$(type -P name)" "${args[@]}"

Call a specific external utility

Specify the full or relative path name containing at least one forward slash.

See also

BashFAQ/086 (last edited 2022-06-11 16:37:18 by ormaaj)