シェルでコマンドがBSD版かGNU版かを見分けるお手軽な方法
man を grep する手があるんじゃないだろうか。
BSD
Macでのコマンド類はデフォルトで BSD版なので、その例。
man man sed | grep -e BSD -e GNU | head -n 1
SED(1) BSD General Commands Manual SED(1)
GNU
Macでは GNU版のコマンドを brew で入れられる。その例。
man man gsed | grep -e BSD -e GNU | head -n 1
disable all GNU extensions.
他のコマンドで試した例
bash-4.4$ man sed | grep -e BSD -e GNU | head -n 1
SED(1) BSD General Commands Manual
bash-4.4$ man gsed | grep -e BSD -e GNU | head -n 1
disable all GNU extensions.
bash-4.4$ man cut | grep -e BSD -e GNU | head -n 1
CUT(1) BSD General Commands Manual
bash-4.4$ man gcut | grep -e BSD -e GNU | head -n 1
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
bash-4.4$ man stat | grep -e BSD -e GNU | head -n 1
STAT(1) BSD General Commands Manual STAT(1)
bash-4.4$ man gstat | grep -e BSD -e GNU | head -n 1
GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Versions
- Mac OS X High sierra
Links
Author And Source
この問題について(シェルでコマンドがBSD版かGNU版かを見分けるお手軽な方法), 我々は、より多くの情報をここで見つけました https://qiita.com/YumaInaura/items/c332966d8d1d8810e97a著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .