我在 Mac 上安装了最新的 GNU/Bash 和 gnu coreutils
$ bash --version
GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin18.0.0)
检查带有 ag 前缀的 coreutils
$ gls -l $(which gls)
lrwxr-xr-x 1 me admin 32 Oct 27 12:50 /usr/local/bin/gls -> ../Cellar/coreutils/8.30/bin/gls
当谈到man
$ man gman
No manual entry for gman
它会回到错误,
$ man man
#works but get BSD manual in year 2003 as return.
我注意到 coreutils 由 GNU fileutils、shellutils 和 textutils 组成,因此手册应该有一个解决方案可供检查。
我如何从 bash 中引用 gnu 手册?
答案1
当您在 macOS 计算机上安装带有 Homebrew 的 GNU coreutils 时,您在成功安装结束时收到此消息:
All commands have been installed with the prefix 'g'.
If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
==> Summary