1. #
annotation function, #! Except
In addition, in the parameter replacement echo ${path#*:} here does not represent a comment, a numbering conversion, does not represent a comment echo $ ((2#101011))
2.;
Command line separator, you can write multiple commands on one line. echo Hello; echo there
3.;;
Terminate case option
Copy code code as follows:
Case "$variable" in
ABC) echo "\ $variable = abc";;
XYZ) echo "\ $variable = xyz";;
Esac
4..
Hide file Prefix
. command is equivalent to source
. Represents the current directory ... Indicates a previous level of directory
Match as a single character in a regular expression
5. "", "
Double quotes, single quotes, where you can reference variables in double quotes, but not in single quotes, which function as organization special characters
6. \
Escape character
7./
File name Separator, Division action
8. ' (ESC button below)
Post reference, command substitution
9.:
Null command, equivalent to "NOP"
can also be considered to be the same as the Shell built-in command true
10.!
The inverse operator!= is not equal to
11. *
Universal matching character, in regular expressions
Math multiplication
* * Power operation
12.?
Test actions
Regular expression,? Match any single character
13. $
Variable symbol
Regular expression row end character
${} parameter substitution
$*,$@ Position Parameters
$? Exit status
$$ Process ID
14. ()
Command group, (A=hello Echo $a), and the list of commands in () will run as a child shell. The variables in (), because they are in the child shell, are not available for the remainder of the script.
Array initialization: array= (element1, Element2, Element3)
{XXX,YYY,ZZZ}
Curly braces Extension
Cat {File1,file2,file3} > Combined_file, merge file1,file2,file3 together and redirect to Commbined_file. Cannot have spaces in curly braces
16. {}
code block. In fact, this structure creates an anonymous function. But unlike a function, the variable declared in it is visible to the code for the rest of the script.
Copy code code as follows:
# The content in the code block, external access, I/O redirection
1: #!/bin/bash
2:
3:file=/etc/fstab
4:
5: # in this block of code variables, external can also access
6: {
7:read line1
8:read line2
9:} < $File
10:
11:echo "The" the "a" in $File is "
12:echo "$line 1"
13:echo
14:echo "Second line in $File is"
15:echo "$line 2"
16:
17:exit 0
# Save the results of a code block to a file
17. {}\;
Path names, are generally used in the Find command, attention; exec to end the find command sequence
18. []
Test
Array elements, such as ARRAY[1]=ABC
The range of characters used in regular expressions
19. [[]]
The test expression itself is placed in []
20. (())
Mathematical calculation extension
>& >>& >> <
redirect
ScriptName > FileName redirect script output to file, overwrite original content
Command &> filename redirect stdout and stderr to file
Command >&2 redirect stdout and stderr
ScriptName >> filename Redirection scripts are exported to the file, added to the end of the file, and if there are no files, create the file.
<< <<<
Redirect, << used in "Here Document", <<< used in "here string"
\<, \>
Word boundaries in regular expressions grep ' \<the\> ' testfile
24. |
Pipe, analyze the output of the front command, and use the output as input to the following command
>|
Force redirection
26. | |
Logical OR
&
Run the command in the background, a command followed by an ampersand, will indicate running in the background
Copy code code as follows:
1: #!/bin/bash
2:
3:for I in 1 2 3 4 5 6 7 8 9 10
4:do
5:echo-n "$i"
6:done&
Note that the last done& of the For loop
&&
Logic and