Bash

請參閱 bash 中的 gnu 手冊頁

  • October 27, 2018

我在 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 手冊。

當您在 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
🍺  /usr/local/Cellar/coreutils/8.30: 430 files, 8.8MB

您是否嘗試更新您的MANPATH變數?

執行建議的命令後,您將ls通過鍵入獲得 GNU 手冊man gls

修改MANPATH是您可以放入文件中的內容(或以類似方式~/.bash_profile更新的任何地方)。PATH


安裝後也可以閱讀上面的安裝消息brew info coreutils

引用自:https://unix.stackexchange.com/questions/478134