Linux Shell programming Variable reference

Source: Internet
Author: User

Shell A total of three reference symbols, double quotes, single quotes and anti-quotes ' (in the English state of the TAB key, 1 keys to the left of the key).

Double quotation mark "": References all characters except dollar sign $, anti-quote ' and backslash \.

Single quote ': refers to all characters.

Anti-quote ': The shell interprets the contents of the anti-quotation mark as a system command.

Backslash \: Escape symbol, masking the special meaning of the next character.


A variable with no double quotation marks is normally the same, for example:

num=10
Echo $num
echo "$num"

The two will print the same content.
Str= "X Y Z"
Echo $str
echo "$str"

The top two will print out different content. $STR print out: x y z, and "$str" prints x y z, and the double quotation marks will print out the original content, without adding multiple spaces to a single space.

Linux Shell programming Variable reference

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.