Shell Basic Command && and | |

Source: Internet
Author: User
The && operator syntax is formatted as follows: Command1 && command2 [&& Command3 ...] 1. Use && connection between commands to implement logic and functions. 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. | Operator: Command1 | | command2| | is the opposite of &&. if | | The command on the Left (Command 1) did not execute successfully, then execute | | The command on the right (command 2), or in other words, "If this command fails to execute | | Then execute this command. 1 Use between commands | | A connection that implements logic or functionality. 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.

Shell Basic Command && and | |

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.