Connectors in the shell (and, and, or)

Source: Internet
Author: User

When using "&&", only Command1 execution succeeds, Command2 will execute, otherwise command2 not execute; [[email protected] ~]# ls 1.txt && ls 2. Txt1.txt2.txt[[email protected] ~]# ls 1.txt && ls 20.txt1.txtls: Inaccessible 20.txt: No file or directory

When using "| |", the Command1 execution succeeds Command2 not execute, otherwise go to execute Command2, in short Command1 and Command2 always have a command to execute.

[[email protected] ~]# ls 1.txt | | LS 20.txt1.txt[[email protected] ~]# ls 10.txt | | LS 20.txtls: Inaccessible 10.txt: No file or directory LS: unable to access 20.txt: No file or directory [[email protected] ~]# ls 10.txt | | LS 1.txtls: Inaccessible 10.txt: No file or directory 1.txt

When using ";", Command2 will be executed regardless of whether Command1 is executed successfully;

[email protected] ~]# ls 10.txt; LS 1.txtls: Inaccessible 10.txt: No file or directory 1.txt


This article is from "Linux rookie" blog, please be sure to keep this source http://490617581.blog.51cto.com/11186315/1759975

Connectors in the shell (and, and, or)

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.