如何阅读 bash 内置函数的手册页?

如何阅读 bash 内置函数的手册页?

所以,我需要弄清楚“exec”是如何工作的。然而,这样做man exec让我看到了一个 99% 无用的手册页,描述了 bash 内置函数是什么。当然,它也对许多其他手册页(例如 cd、chdir 等)执行此操作。

如何查找我感兴趣的实际实用程序的手册页,而不是内置手册页?

我的操作系统是 Mac OSX,但我在其他操作系统上也有这个

答案1

可以使用命令获取 shell 内置命令的文档 help。例如:

$ help exec
exec: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
    Replace the shell with the given command.

    Execute COMMAND, replacing this shell with the specified program.
    ARGUMENTS become the arguments to COMMAND.  If COMMAND is not specified,
    any redirections take effect in the current shell.

    Options:
      -a name   pass NAME as the zeroth argument to COMMAND
      -c                execute COMMAND with an empty environment
      -l                place a dash in the zeroth argument to COMMAND

    If the command cannot be executed, a non-interactive shell exits, unless
    the shell option `execfail' is set.

    Exit Status:
    Returns success unless COMMAND is not found or a redirection error occurs.

否则,可以运行man bash然后在其中进行搜索(/\bexec\b在本例中,假设是一个不太相似的寻呼机,可以输入 )。

相关内容