Shell BASICS (3) -- quotation marks and shell basics -- quotation marks

Source: Internet
Author: User

Shell BASICS (3) -- quotation marks and shell basics -- quotation marks

--- Today, the space is relatively small; only quotation marks are introduced.

There are three types of quotation marks in shell: Double quotation marks ", single quotation marks", and reverse quotation marks'
1. Double quotation marks: A character enclosed by double quotation marks. Except for the special functions of $, inverted quotation marks ('), and backslash (\), other characters are treated as common characters.
2. Single quotes: All characters enclosed by single quotes appear as common characters.
3. Reverse quotation marks: a type of replacement command.

I. Why quotes?

We have discussed variables before. All variables are strings;

var01=100var02='100'var03="100"

The output results are the same, and the string is 100.

If the string is a familiar hello world. Try it without quotation marks. An error is reported. The explanation is as follows:
Here we reference the wall theory:
Single quotes, double quotes are equivalent to walls. If no quotation marks are required, echo hello world. Will output hello. World will also be treated as an executed operation. Otherwise. Tell linux. Hello world is a whole.

Ii. Difference between single quotation marks and double quotation marks

As for the difference, the previous explanation is clear. In fact, it is equivalent to a single quotation mark ("strong quotation marks") and a double quotation mark ("weak quotation marks ". Except for $, inverted quotation marks ('), and backslash (\), the special features are retained. They are similar.

Iii. Reverse quotation marks

Reverse quotation marks are used to replace commands. The exception is $ (). What kind of interests do you use. For example:

Echo 'date' echo "current directory is 'pwd'" # Can the double quotation marks be replaced with single quotation marks? Think about it, cool.

 


What are the meanings of the three double quotation marks in vbs Script Programming? example: WshShellRun "" C: \ Program Files \ aaexe """

A pair of quotation marks indicates that the data type is a string.
The remaining two pairs of quotation marks are used to remove spaces ".

If there is no space in the path, you can use a pair of quotation marks (indicating that the data type is string type ).
For example:
CreateObject ("WScript. Shell"). Run "c: \ hello.exe"

What are the meanings of the three double quotes in vbs programming? example: WshShellRun "" C: \ Program Files \ aaexe """

WshShell. Run "" C: \ Program Files \ aa.exe """

Can be written in the same way
WshShell. Run chr (34) & "C: \ Program Files \ aa.exe" & chr (34)

The two quotation marks mean the character"
The actual running code is "C: \ Program Files \ aa.exe"
Not C: \ Program Files \ aa.exe
This is because the file path contains spaces.

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.