Bird Brother linux-- command execution of judgments based on:;, &&, ||

When executed you must first execute multiple instructions once, rather than one by one. The following provides a solution:

cmd;cmd

This method is in fact the presence of temporal correlation, that is executed from left to right. When you run the program to meet this correlation, you can use this method. Meanwhile, when there is no relationship between all your instructions, it can also be used. When mixed with your instructions forward a similar view of the relationship, it can not.

$? (Command return value) and && or ||

This method for the existence of a relationship between instructions.

Note: && there is a language feature of all languages, that is such a && b, is a must first meet before judgment b meet, where there will be a logical error. At the time of writing instruction should pay attention to.

Sample a: first determination / A exists or not exist, a new file file1 
LS / a && Touch / a / File

Note: a || b, when a successfully implemented, it will not perform b, similarly, when a mistake, but b successful, it will not display an error on the screen

 

Guess you like

Origin www.cnblogs.com/ALINGMAOMAO/p/11712936.html