The difference between single and double quotes in Linux

Source: Internet
Author: User

1. All characters within the single quotation mark retain the meaning of its own character, without being interpreted by bash, echo-e the escape character (\n,\t, etc.) will be interpreted, such as echo-e ' Aa\naa ' will be two lines AA.

2. In addition to $, ' (not single quotes) and \, all characters within the double quotation mark retain the meaning of the character itself without being interpreted by bash. $ and ' inside the double quotation marks, if not escaped by the escape character (\), will unconditionally keep the special meaning under bash, while the escape character (\) is conditional. The escape character is only followed by $, ', double quotes, and \ Four special characters characters have special meaning under bash: escape, in other words, only the above four characters can be escaped in double quotes. If the \ character followed by a character other than four characters in double quotes, \ is \ itself, there is no special meaning. Echo-e when the escape character (\n,\t, etc.) will be interpreted, such as echo-e ' Aa\naa ' will be two lines AA.

The difference between single and double quotes in Linux

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.