Meet |
Meaning |
&& |
Command1 && command2: Command 1 returns True (command return value $? = = 0) after which command 2 talent is run. Can be used for if inference. CP 1.txt.. /&& echo "succes" #-->success CP 1.txt.. /&& rm-f. /1.txt && echo "Success"-->success |
|| |
Command1 | | Command2: Command 1 returns False (the command returns a value of $? = = 1) after which command 2 talent is run. Can be used for if inference. CP 1.txt.. / || echo "Fail" #-->fail CP 1.txt.. / || Rm.. /1.txt | | echo "Fail"-->fail |
& |
Command1 & Command2 & Command3:3 commands run at the same time Command &:comand commands are executed in the background, in effect placing the command 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, very many times, we want to start in the background, can be in the start of the parameter with a ' & ' to achieve this. Toggle between front and rear: ability to switch between the front and back of the background via the BG <jobid> (background) and fg<jobid> (foreground) commands. |
| |
Pipeline, the last command output as input to the next command; Throw the result of the previous command execution to the following command. Not all commands are available, generally for document operations, such as Cat, less, head, tail, grep, cut, sort, WC, uniq, tee, tr, split, SED, awk, etc., where grep, sed, Awk is a must-have tool ls | Wc–l-->11 |
( ) |
(Command1;command2;command3 ...): runs a set of commands, commands the group concept, commands itself with, separates, the end command can not be used, separated, the first command and (can not have a space between (PWD;CD.; PWD) #-->/home/robot/home |
[ ] |
Used for 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, ...}: runs a set of commands, commands the group concept, commands itself, separates, commands at the end are required; separate, there must be a space 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-cited, excluding the content it contains as ordinary characters, but the 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 |
`` |
The inverse single (with the ~ same key), ' command ' and $ (command) mean the same, both return the result of the current Run command Command replacement. Command substitution refers to the ability of the shell to run commands first. Save the output temporarily and output it in the appropriate place. p= ' pwd '; echo $p; -->/home
|
\ |
An escape character that removes the specific meaning of the symbol (eg:*|&). Turn it into a regular punctuation mark |
; |
Semicolon: In the shell, the symbol that functions as a "continuous instruction" is a semicolon. Command1;command2;command3: Whether the previous command runs successfully or not, the subsequent commands continue to run |
;; |
Continuous semicolon: Special option in case, role as Terminator |
# |
#井号: Gaze |
! |
Usually it represents the function of the anti-logic, as in conditional inference. Use! = to represent "not equal" |
? |
Represents a random character |
* |
Represents 0 or more characters or numbers |
** |
Sub-square operation echo $ ((2**3)) –>8 |
$ |
Variable Value A=1;echo $a;-->1 |
|
|
|
|