1. References

Source: Internet
Author: User

There are two types of characters in the shell, the ordinary character and metacharacters characters.

You must borrow a reference when you want to remove the special meaning of the metacharacters to restore their literal meaning. There are typically three types of references, escaping, strong references (using single quotes), and weak references (using double quotes).

Strong reference: Any character in a single quotation mark is treated as a normal character, except for the single quotation mark itself. Cannot include single quotation marks in the middle of two single quotes, not with escape.

Weak references: In addition to the double quotes themselves, most of the characters nonalphanumeric as normal. The exception is \, $, ' three special characters, because of the existence of special characters \, so in the middle of the double quotation marks can be escaped to contain double quotation marks. $1 You can use variables

$var 2. Reference arithmetic expression $ (()) 3. command to replace $ ().

About Echo:

BSH: Explains the escape character sequence and cannot be turned off.

Ksh: The default interpretation escape character sequence can be switched off with the-e option.

BASH: The default does not explain the escape character sequence, which can be opened with the-e option.

echo Print Color output:

color code: RESET = 0 Black = 30 Red = 31, green = 32, yellow =33 blue = 34 Magenta =35 cyan = 36 White =37

Echo-e "\e[1;31m This is red text\e[0m"

Environment variables:

Environment variables are generally described in the form of Name=value, separated by a null character (s) from each other. If you change it to \ n, then

You can reformat the output.

Cat/proc/12501/environ | Tr ' + ' \ n '

1. References

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.