Multiple commands are executed continuously under Linux

  

Sometimes when you execute some simple instructions, you don't want to input them several times. You can easily execute multiple commands at once by using the following methods.
Continuous uninterrupted execution

Use; can let multiple commands continue to know, there is an error in the middle and will not interrupt the following commands, such as

mkdir test; mkdir test; rmdir test;

Although the second instruction will report an error, but Will not affect the following instructions, the last test directory does not exist
error stop the following instructions

Use && split command, if there is no error will continue to execute, the error will immediately stop, such as

mkdir test && mkdir test && rmdir test

This time it is aborted at the second instruction.
After correct, stop

Use| | The split command, if there is an error, will continue until the correct stop immediately, such as

mkdir test |
 |
  Mkdir test |
 |
  Rmdir testmkdir test |
 |
  Mkdir test |
 |
  Rmdir test |
 |
  Mkdir test

The first execution of the first instruction is correct, the latter is not executed.

The first two executions are wrong until the last one is correct, and the last one is no longer executed

Copyright © Windows knowledge All Rights Reserved