Several methods of executing multiple commands in the linux shell

Multiple commands can be executed at one time on the command line, including the following:

 

1. Separate each command with ;

Note: The execution of each command gives the result and will not affect the execution of other commands. In other words, each command is executed,

But there is no guarantee that every command will be executed successfully.

 

2. Separate each command with &&

Note: If the previous command is executed successfully, the following command will be executed. This ensures that after all commands are executed, the execution process is successful.

3. Separate each command with ||

Description: || is or means, only after the previous command fails to execute the next command, until the execution is successful

until one command.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326511253&siteId=291194637