Linux命令 help - 該命令是bash內(nèi)建命令,用于顯示bash內(nèi)建命令的幫助信息

2021-11-12 10:52 更新

help

該命令是bash內(nèi)建命令,用于顯示bash內(nèi)建命令的幫助信息。

補充說明

help命令 help命令只能顯示bash內(nèi)建命令的幫助信息,而對于外部命令的幫助信息只能使用man或者info命令查看。

語法

help(選項)(參數(shù))

選項

-d:顯示內(nèi)建命令的簡要描述。
-m:按照man手冊的格式輸出內(nèi)建命令的幫助信息。
-s:僅輸出內(nèi)建命令的命令格式。
不指定選項時:輸出的幫助信息類似于-m選項,但是缺少段落名稱和'SEE ALSO''IMPLEMENTATION'部分。

參數(shù)

bash內(nèi)建命令(可以為多個,請用空格分隔開)。

常見問題

Q:有哪些命令是bash內(nèi)建命令?我如何判斷一個命令是否為bash內(nèi)建命令?

A:您可以在終端使用 'man builtin' 或 'man builtins' 來獲?。荒梢圆榭碽ash內(nèi)建命令 'type' 的幫助信息。

Q:那么help命令本身的幫助信息如何獲???

A:把help作為參數(shù)傳給help命令;)

Q:為什么echo也可以用 'man echo' 來查看幫助信息?

A:因為除了bash內(nèi)建的echo,GNU/linux的coreutils包里也有該命令;在echo的man手冊中,DESCRIPTION段落的 'NOTE' 也提示了和同名內(nèi)建的不同。

PS:當(dāng)你在shell腳本里定義了一個叫 'echo' 的函數(shù),那么調(diào)用的時候優(yōu)先級會如何呢?

請參考 'builtin' 命令

Q:我需要獲得更多的bash的相關(guān)幫助信息

A:限于篇幅和主題,您可以在終端執(zhí)行 'man bash' , 'info bash' ,訪問bash官方網(wǎng)站,以及搜索引擎等。

實例

使用help命令顯示shell內(nèi)部shopt命令的幫助信息,輸入如下命令:

help shopt                #獲取shopt命令的幫助信息
shopt: shopt [-pqsu] [-o long-option] optname [optname...]
    Toggle the values of variables controlling optional behavior.
    The -s flag means to enable (set) each OPTNAME; the -u flag
    unsets each OPTNAME.  The -q flag suppresses output; the exit
    status indicates whether each OPTNAME is set or unset.  The -o
    option restricts the OPTNAMEs to those defined for use with
    `set -o'.  With no options, or with the -p option, a list of all
    settable options is displayed, with an indication of whether or
    not each is set.


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號