我如何获得有关zsh内置的帮助消息?


13

如果我想获得内置bash的简短用法消息,可以help <builtin>在命令提示符下使用,例如

$ help export
export: export [-fn] [name[=value] ...] or export -p
    Set export attribute for shell variables.

    Marks each NAME for automatic export to the environment of subsequently
    executed commands.  If VALUE is supplied, assign VALUE before exporting.

    Options:
      -f        refer to shell functions
      -n        remove the export property from each NAME
      -p        display a list of all exported variables and functions

    An argument of `--' disables further option processing.

    Exit Status:
    Returns success unless an invalid option is given or NAME is invalid.

如何在zsh中执行此操作?我试过了

% export --help
zsh: bad option: -e

% help export
zsh: command not found: help

此外,“帮助”一词也不在中man zshbuiltins

Answers:


5

感谢@don_crissti通过Arch维基文档链接。
由于某种原因,Arch Wiki上的代码会在调用时导致此错误

/home/velour/.zshrc:unalias:368:无此类哈希表元素:运行帮助

zsh --version => zsh 5.1.1(x86_64-ubuntu-linux-gnu)

为了使其正常工作,我在下方添加了以下代码块~/.zshrc,然后注释掉了别名命令。

autoload -Uz run-help
autoload -Uz run-help-git
autoload -Uz run-help-svn
autoload -Uz run-help-svk
#unalias run-help
#alias help=run-help

并简单地用

run-help <builtin>

所以现在我明白了

% run-help export

export [ name[=value] ... ]
       The specified names are marked for automatic export to the envi-
       ronment  of subsequently executed commands.  Equivalent to type-
       set -gx.  If a parameter specified does not already exist, it is
       created in the global scope.

@don_crissti我已经用错误和zsh版本的详细信息更新了我的答案。
the_velour_fog's

也许就是这样
don_crissti

7
我尝试过此操作而没有取消注释别名,而我仅获得zshbuiltins手册页。如何在不搜索特定内置函数的情况下获得帮助?
艾迪生
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.