command used by the shell (1)--"and (&&)", "OR (| | )”,“:”,"."

Source: Internet
Author: User

Commands common to the shell:

1, and list with or list:

1), and List (&&):

Executes the next command when the previous command executes successfully.

When there is an execution failure, reverse the "failure code" directly.

Use:

Statement 1 && Statement 2 && statement 3 && .....


2), or list (| | ):

In contrast to &&, the next statement executes after the current statement fails.

Use:

Statement 1 | | Statement 2 | | Statement 3 | | 。。。。。

3), the above two can be combined, for logical processing.

4), the command can be combined into blocks execution.

Statement 1 && {Statement 2 | | Statement 3}

2, ":" Command:

1), in fact, ":" is an empty command. Used to simplify conditional logic, equivalent to "true"

Like what:

While://Make an infinite loop.

2), for variable settings:

Like what:

: ${var:=value}//may be treated as a command when $var does not have ":".

3, "." Command:

1), used to indicate execution within the current shell, does not create a child shell.

Equivalent to the "source" command.


command used by the shell (1)--"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.