Meet |
Meaning |
&& |
Command1 && command2: Command 1 returns True (Command return value $ = = 0), command 2 can be executed. Can be used for if judgment. CP 1.txt.. /&& echo "succes" #-->success CP 1.txt.. /&& rm-f. /1.txt && echo "Success"-->success |
|| |
Command1 | | Command2: Command 1 returns False (command return value $ = = 1), command 2 can be executed. Can be used for if judgment. CP 1.txt.. / || echo "Fail" #-->fail CP 1.txt.. / || Rm.. /1.txt | | echo "Fail"-->fail |
& |
Command1 & Command2 & command3:3 commands simultaneous execution Command &:comand commands run in the background, in effect putting commands into a job queue. By default, the process is the foreground process, then the shell is occupied, we can not do other operations, for those who do not interact with the process, many times, we want to start in the background, you can start the parameters with a ' & ' to achieve this purpose. Toggle between front and back: the BG <jobid> (background) and fg<jobid> (foreground) commands allow them to switch between pre-and post-background states. |
| |
Pipeline, the last command output as input to the next command; Throw the result of the previous command run to the following command. Not all commands are available, general commands for document operations are commonly used, such as cat, less, head, tail, grep, cut, sort, WC, uniq, tee, tr, split, SED, awk, and so on, where grep, SED, a WK A tool that must be mastered for regular expressions ls | Wc–l-->11 |
( ) |
(Command1;command2;command3 ...): executes a set of commands, commands the group concept, commands itself, separates, the end command can not be used, separated, the first command and (there can be no space between (PWD;CD.; PWD) #-->/home/robot/home |
[ ] |
Used to test commands, which can be understood as test commands If ["$?"! = 0] <==> if test "$?"! = 0 |
$[ ] |
Integer calculation (+-*/%): Echo $[2-3]-->1 Floating point calculation (+-*/): c=$ (echo "0.5/0.5" |BC); Echo $c-->1 |
$(()) |
Evaluates an expression in parentheses, echo $ ((+))-->2 integer Operation +-*/% |
{ } |
{Command1;command2;command3 ...}: executes a set of commands, commands the group concept, commands itself, separates, and ends with commands that need to be separated from each other, and there must be spaces between the first command and { A=1;echo $A; {a=2;}; echo $A #--> 1 2 A=1;echo $A;( a=2; ) echo $A #--> 1 1 |
(( )) |
This set of symbols is similar to the Let directive, and is used in arithmetic operations, which is the built-in function of bash. |
"" |
Double quotation marks, excluding the contents of which it contains as ordinary characters, but single quote "', backslash \, dollar sign $, anti-single quote ' ' A=1;echo "1+ $a";-->1+1 A=1;echo "1+ ' $a '";-->1+ ' 1 ' A=1;echo "1+$ ' a '";-->1+$ ' a ' echo "\ $a";-> $a |
‘‘ |
Single quote, which contains the contents as ordinary characters, no exceptions A=1;echo ' 1+ $a ';-->1+ $a |
`` |
Anti-single quotation marks (with the ~ same key), ' command ' with the same meaning as $ (command), return the result of the current execution command Command substitution, which means that the shell can execute the command first, save the output temporarily, and output it in the appropriate place. p= ' pwd '; echo $p; -->/home
|
\ |
Escape character, remove the specific meaning of the symbol (eg:*|&) and make it a normal punctuation mark |
; |
Semicolon: In the shell, the symbol that functions as a "continuous instruction" is a semicolon. Command1;command2;command3: Regardless of whether the previous command executed successfully or not, the following command continues to execute |
;; |
Continuous semicolon: Special option in case, role as Terminator |
# |
#井号: Notes |
! |
Usually it represents the function of anti-logic, such as conditional judgment, in! = to represent "not equal" |
? |
Represents any one character |
* |
Represents 0 or more characters or numbers |
** |
Sub-square operation echo $ ((2**3)) –>8 |
$ |
Variable Value A=1;echo $a;-->1 |
|
|
|
|