bash help

在「bash」的環境,可以執行下面的指令,顯示「Shell Builtin Commands」的相關資訊。

$ help

顯示

GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

 job_spec [&]                                                 history [-c] [-d offset] [n] or history -anrw [filename] >
 (( expression ))                                             if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMAND>
 . filename [arguments]                                       jobs [-lnprs] [jobspec ...] or jobs -x command [args]
 :                                                            kill [-s sigspec | -n signum | -sigspec] pid | jobspec ..>
 [ arg... ]                                                   let arg [arg ...]
 [[ expression ]]                                             local [option] name[=value] ...
 alias [-p] [name[=value] ... ]                               logout [n]
 bg [job_spec ...]                                            mapfile [-n count] [-O origin] [-s count] [-t] [-u fd] [->
 bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u n>  popd [-n] [+N | -N]
 break [n]                                                    printf [-v var] format [arguments]
 builtin [shell-builtin [arg ...]]                            pushd [-n] [+N | -N | dir]
 caller [expr]                                                pwd [-LP]
 case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac>   read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [>
 cd [-L|[-P [-e]] [-@]] [dir]                                 readarray [-n count] [-O origin] [-s count] [-t] [-u fd] >
 command [-pVv] command [arg ...]                             readonly [-aAf] [name[=value] ...] or readonly -p
 compgen [-abcdefgjksuv] [-o option]  [-A action] [-G globp>  return [n]
 complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A actio>  select NAME [in WORDS ... ;] do COMMANDS; done
 compopt [-o|+o option] [-DE] [name ...]                      set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
 continue [n]                                                 shift [n]
 coproc [NAME] command [redirections]                         shopt [-pqsu] [-o] [optname ...]
 declare [-aAfFgilnrtux] [-p] [name[=value] ...]              source filename [arguments]
 dirs [-clpv] [+N] [-N]                                       suspend [-f]
 disown [-h] [-ar] [jobspec ...]                              test [expr]
 echo [-neE] [arg ...]                                        time [-p] pipeline
 enable [-a] [-dnps] [-f filename] [name ...]                 times
 eval [arg ...]                                               trap [-lp] [[arg] signal_spec ...]
 exec [-cl] [-a name] [command [arguments ...]] [redirectio>  true
 exit [n]                                                     type [-afptP] name [name ...]
 export [-fn] [name[=value] ...] or export -p                 typeset [-aAfFgilrtux] [-p] name[=value] ...
 false                                                        ulimit [-SHabcdefilmnpqrstuvxT] [limit]
 fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [co>  umask [-p] [-S] [mode]
 fg [job_spec]                                                unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMANDS; done                 unset [-f] [-v] [-n] [name ...]
 for (( exp1; exp2; exp3 )); do COMMANDS; done                until COMMANDS; do COMMANDS; done
 function name { COMMANDS ; } or name () { COMMANDS ; }       variables - Names and meanings of some shell variables
 getopts optstring name [arg]                                 wait [-n] [id ...]
 hash [-lr] [-p pathname] [-dt] [name ...]                    while COMMANDS; do COMMANDS; done
 help [-dms] [pattern ...]                                    { COMMANDS ; }

type help

$ type help

顯示

help is a shell builtin

help help

執行

$ help help

顯示

help: help [-dms] [pattern ...]
    Display information about builtin commands.

    Displays brief summaries of builtin commands.  If PATTERN is
    specified, gives detailed help on all commands matching PATTERN,
    otherwise the list of help topics is printed.

    Options:
      -d        output short description for each topic
      -m        display usage in pseudo-manpage format
      -s        output only a short usage synopsis for each topic matching
        PATTERN

    Arguments:
      PATTERN   Pattern specifiying a help topic

    Exit Status:
    Returns success unless PATTERN is not found or an invalid option is given.

man bash

執行

$ man bash

找尋「SHELL BUILTIN COMMANDS」可以找到下面這一段說明

SHELL BUILTIN COMMANDS
       Unless  otherwise  noted,  each  builtin  command documented in this section as accepting options preceded by -
       accepts -- to signify the end of the options.  The :, true, false, and test builtins do not accept options  and
       do not treat -- specially.  The exit, logout, break, continue, let, and shift builtins accept and process argu‐
       ments beginning with - without requiring --.  Other builtins that accept arguments but  are  not  specified  as
       accepting options interpret arguments beginning with - as invalid options and require -- to prevent this inter‐
       pretation.

...略...

bash reference manual

查看「Bash Reference Manual / 4 Shell Builtin Commands (網址2)」

若有安裝「bash-doc」這個套件

則可以執行下面的指令觀看

$ info bash -n 'Shell Builtin Commands'