Explanation of the difference between ‘;’ and ‘& &’ in Linux

Time:2021-4-22

preface

In the process of Linux operation and maintenance or daily Linux system operation, multiple commands will be executed at the same time, which needs to be processed through our multiple command mode. Multi command execution includes’; ‘and’ & & ‘commands, so that the shell can execute multiple commands at one time, and each command can be separated by’; ‘and’ & & ‘commands. So what’s the difference between the two? Let’s take a look.

1、’;’

Use ‘;’ – — to execute the first command first, and execute the next command no matter whether the first command is wrong or not.

2、’&&’

When the first command is executed correctly, the next command will be executed, similar to short circuit.

summary

Well, the above is the whole content of this article, I hope the content of this article can bring some help to your study or work, if you have any questions, you can leave a message to exchange.