Shell 1, Shell Script Foundation and several ways to execute

Source: Internet
Author: User


“#! Magic Number: The general specification at the beginning of the script, used to specify the interpreter to execute the contents of the script. Note: Only the first line of the script #! Valid, followed by a comment! If you do not specify an interpreter, the default shell execution script for the current system defaults to bash. Common example: #!/bin/bash #!/bin/sh# Note: Comments on the script, only for developers to see, the system cannot be tagged, comments will not be executed The comment can be self-made, or it can follow the script command on the same line as the command. Script execution order: From top to bottom, left to right, nested scripts execute nested scripts first. The shell script executes several ways: ①bash script or SH script advantage: When the script does not execute permissions, that is, the user file permission attribute does not have X-bit or the script file does not specify the interpreter at the beginning "#! /bin/bash "can be run directly. Recommended index: ★★★★★②path/script or./script path execution script, absolute or relative path script directly run, note: Need to have X permission, that is, execute permissions, chmod +x Script. Recommended index: ★★★③source or. In this case, for the time being, it is not clear that the load executes commands and statements in the relevant script without the additional child shell to execute the command, which can be executed directly without executing the Script Recommendation index: no ④sh<script or cat Script|sh Place all the characters in the form of a bit command, and then pass the pipeline over to bash. Recommended Index: ★ ¡ï


This article is from the IT Technology blog blog, so be sure to keep this source http://weonline.blog.51cto.com/1467072/1935035

Shell 1, Shell Script Foundation and several ways to execute

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.