Go Linux executes multiple commands on a single command line

Source: Internet
Author: User

Original link: http://blog.sina.com.cn/s/blog_6238358c0100rzvd.html

For a single command execution I think most people are clear about executing a command on a command line. What about executing multiple commands on a single line, in fact, it's very simple, just add a special command symbol between the commands, and we routinely use 3 special command symbols.

1. [ ; ]

If the semicolon (;) is The delimited command executes continuously, and even the wrong command continues to execute the subsequent command.

[Email protected] etc]# LLD; echo "OK"; Lok
-bash:lld:command not found
Ok
-bash:lok:command not found

2. [ && ]

If the command is separated by && , then the command will continue to execute, but there is a wrong command in the middle that will not execute the subsequent command, yes, it will go straight to the end.

[[email protected] etc]# echo "OK" && lld&& echo "OK"
Ok
-bash:lld:command not found

3.[ | |]

If each command is double vertical Bar | | , then a command that encounters a successful execution stops executing the subsequent command, regardless of whether the subsequent command is correct or not. If the command that executes to the error is to continue execution of the latter command until the correct command is encountered.

[[email protected] etc]# echo "OK" | | echo "haha"
Ok
[Email protected] etc]# LLD | | echo "OK" | | echo "haha"
-bash:lld:command not found
Ok

Go Linux executes multiple commands on a single command line

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.