help

This command is a bash built-in command and is used to display help information for bash built-in commands.

Supplementary instructions

help command The help command can only display help information for bash built-in commands, and help information for external commands can only be viewed using the man or info command.

grammar

help(option)(parameter)

Options

-d: Display a brief description of the built-in command.
-m: Output help information for built-in commands in the format of the man manual.
-s: Only output the command format of built-in commands.
When no option is specified: the output help information is similar to the -m option, but the paragraph name and the 'SEE ALSO', 'IMPLEMENTATION' part are missing.

Parameters

bash built-in commands (can be multiple, please separate them with spaces).

common problem

Q: What commands are built-in bash commands? How can I tell if a command is a bash built-in command?

A: You can use 'man builtin' or 'man builtins' in the terminal to obtain it; you can view the help information of the bash built-in command 'type'.

Q: How to obtain the help information of the help command itself?

A: Pass help as a parameter to the help command;)

Q: Why can echo also use 'man echo' to view help information?

A: Because in addition to the built-in echo in bash, this command is also included in the coreutils package of GNU/linux; in the man manual of echo, the 'NOTE' in the DESCRIPTION paragraph also indicates the difference from the built-in one with the same name.

PS: When you define a function called 'echo' in a shell script, what will be the priority when calling it?

Please refer to the 'builtin' command

Q: I need more help information about bash

A: Due to space and topic limitations, you can execute 'man bash', 'info bash' in the terminal, visit bash official website, and search engines, etc.

Example

Use the help command to display the help information of the shopt command inside the shell. Enter the following command:

help shopt #Get help information for the shopt command
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.