The difference and relation between the inverted quotation mark and the double quotation mark in shell script

Source: Internet
Author: User

Double quotes

Purpose: In order to contain text or function segments. In addition to itself, the function inside the counter-quote, the variable starting with $ and \ Start the inverse of the character outside, the rest are directly output.

The content enclosed in double quotes is treated as a single string. It prevents wildcard expansion, but allows variable expansion. This is different from the way a single argument is handled.

Anti-Quote

The purpose is to keep the function conversion within the double quotation marks. But the single quotation mark has no effect. in the preceding single double quotation mark, enclose the string, but what if the string is a list of command columns? The answer is no execution. To deal with this situation, we have to use anti-single quotes to do it.
fdv= ' Date +%f ' echo "Today $FDV"
The date +%f in the inverted quotation marks is treated as an instruction, and the result of execution is taken into the FDV variable.


The difference and relation between the inverted quotation mark and the double quotation mark in shell script

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.