--- 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.
Shell BASICS (3) -- quotation marks