Some details about Unix shell programming

Source: Internet
Author: User
  • The test statement must have spaces before and after the equal sign, and there can be more than one space. To promote it, there must be no spaces before and after the equal sign of the value assignment statement, non-assignment statements require spaces (I dare not say so)
  • Double quotation marks are equivalent to double quotation marks under printf. single quotation marks are a string bracket, which contains the string content.
  • True. For example, if a successful match in test is returned, 0 is returned, and if is the valid true value.
  • Declare a numeric parameter: declare-I X. FOR MORE DECLARE usage, click here.
  • A script running in shell is a sub-terminal running on the login terminal. The sub-terminal has its own environment, and the login terminal shares environment variables with the sub-terminal. the export data in the sub-terminal does not change in the parent terminal, but in turn is valid.
  • Shell first processes pipe and redirection, and then performs variable substitution. Sometimes the command must be replaced first (especially for processing special symbols), and the eval command
  • Jing @ Jing-LAPTOP :~ $ E =; echo $ E; echo $ {e:-/bin}; echo $ E

    /Bin

    Jing @ Jing-LAPTOP :~ $ E =; echo $ E; echo $ {e: =/bin}; echo $ E

    /Bin
    /Bin
    Note:-And: = both set a default value. When the variable is empty, the default value is substituted. The former is only a temporary replacement, and the latter is a value assignment to the variable.

  • Shell Command Prompt function: press TAB twice, you can only press tab, then you can output all commands, or enter some prompt words, and then press tab, such as O + TAB, list all commands starting with "O"
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.