Linux command
disable 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Disable a shell builtin
disable [builtin_name]
Disable a shell function
disable -f [function_name]
Disable a regular alias
disable -a [alias_name]
Disable a reserved word
disable -r [reserved_word]
Disable a glob pattern operator
disable -p '[operator]'
List all currently disabled builtins
disable
说明
disable is a zsh builtin that temporarily deactivates named hash table elements. By default it operates on builtins: when a builtin is disabled, the shell will search $PATH for an external command of the same name instead. This is useful for forcing the use of an external version of a command over the shell builtin, such as using an external echo or test instead of the builtin version. The command extends beyond builtins to aliases (-a), functions (-f), reserved words (-r), suffix aliases (-s), and even glob pattern operators (-p). When invoked without arguments, it lists all disabled elements from the corresponding hash table. Disabled elements can be re-enabled with the enable builtin.
参数
- -a
- Act on regular or global aliases
- -f
- Act on shell functions
- -m
- Treat arguments as glob patterns for matching multiple elements at once (patterns should be quoted)
- -p
- Act on elements of the shell's pattern (globbing) syntax, such as ?, \*, [, ~, ^, and #
- -r
- Act on reserved words
- -s
- Act on suffix aliases
FAQ
What is the disable command used for?
disable is a zsh builtin that temporarily deactivates named hash table elements. By default it operates on builtins: when a builtin is disabled, the shell will search $PATH for an external command of the same name instead. This is useful for forcing the use of an external version of a command over the shell builtin, such as using an external echo or test instead of the builtin version. The command extends beyond builtins to aliases (-a), functions (-f), reserved words (-r), suffix aliases (-s), and even glob pattern operators (-p). When invoked without arguments, it lists all disabled elements from the corresponding hash table. Disabled elements can be re-enabled with the enable builtin.
How do I run a basic disable example?
Run `disable [builtin_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a do in disable?
Act on regular or global aliases