- & placed after the startup parameter to set this process as a background process
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.
2. && | |
When the shell executes a command, it returns a return value that is saved in the shell variable $? In When $? = = 0 o'clock, indicating successful execution; = = 1 O'Clock (I think the number is 0 and the return value is 0-255), indicating that the execution failed.
Sometimes the next command depends on whether the previous command succeeds. For example, execute another command after executing a command successfully, or execute another command after a single command fails. The shell provides && | | To implement command execution control, the shell will be based on && or | | The return value of the preceding command to control the execution of subsequent commands.
The syntax format is as follows:
Command1 && command2 [&& Command3 ...]
1 use && Connect between commands to achieve
Logic with the function.
2 only the command on the left of && returns True (command return value $?). = = 0) The command to the right of,&& will be executed.
3 As long as there is a command return False (command return value $?) = = 1), the subsequent command will not be executed.
Logical OR function
Command1 | | Command2 [| | Command3 ...]
1 Use between commands | | Connect, implement
Logical OR function.
2 Only in | | The left command returns False (the command returns a value of $?). = = 1), | | The command on the right will not be executed. This is the same as the logical or syntactic function in C, which is to implement short-circuit logic or operations.
3 As long as there is a command return True (command return value $?) = = 0), the subsequent command will not be executed. – Stop execution until it returns to the real place.
Linux Shell several special symbols Command &, &&, | |