Linux distributions standard shell: BASH software usage instructions, distributionsbash
BASH is one of the most important tools and software in the GNU program. It is also the standard shell for Linux distributions. Bash has the following functions:
Command editing capability (history): records the commands used and stores them in the directory. bash_history. You can use the up and down keys to find the commands you have entered. Command alias setting function (alias): use aliases to replace other commands, such as alias lm = 'LS-al' job control and foreground background control stylized scripts (shell scripts)
Type to check whether the command is a built-in bash shell command
Type name
If no option parameter is added, type indicates whether the name command is an external command or a bash built-in command.
Use of shell function echo Function
Echo DISPLAY variable
Add $ before the variable name. For more echo functions, Run man echo.
For example, the Environment Variable HOME is displayed.
Echo $ HOME
In bash, when the variable name is not set, the result is not displayed.
-E indicates that escape is enabled. the following commands in the string have special meanings.
\ N line feed, move the cursor to the beginning of the line \ t Insert tab \ f line feed, but the cursor stays at the original position \ a sends a warning
Variable setting and Modification
Use = to set the variable. = no space is allowed on both sides. The variable name can only contain English letters and numbers, but cannot start with a number. Use unset to cancel variable settings. If you want to execute it in a subroutine, the export must be an environment variable. Command: The export PATH variable has blank characters, which use double quotation marks (") or single quotation marks ("). However, special characters (such as $) in double quotation marks keep their original features, special characters in single quotes can only use the \ next line for general characters. when extending the variable content, use the following method. For example, PATH = "$ PATH":/home/bin
You can use variable definitions to simplify directories. For example
Work = "/home/xinming/code /"
Cd $ work
Read, variable reading
Read reads the variables from the keyboard.
Read [-pt] variable
Meaning of option parameters:
-P: the content that can be followed by the prompt-t: the number of seconds that can be followed by the waiting time (if the specified number of seconds does not have any action, it will be skipped automatically)