Single quotes
Purpose: To prevent text conversion. Except for the single quotation marks, all words in the single quotation marks are output as is.
1. [root @ jszwl161 sp49ep9] # echo '$ *> <! '
$ *> <!
2. [root @ jszwl161 sp49ep9] # echo 'she is crying: "Help "'
She is crying: "Help"
3. [root @ jszwl161 sp49ep9] # echo '\\\\'
\\\\
4. [root @ jszwl161 sp49ep9] # echo 'hah'test''
Hah test # skipped all'
5. [root @ jszwl161 sp49ep9] # echo 'Today is 'date''
Today is 'date' # The function cannot be implemented here.
Double quotation marks
Purpose: To include text or function segments, except for functions in the backquotes, variables starting with $, and characters in the backticks are directly output.
1. [root @ jszwl161 sp49ep9] # echo "Today is 'date '"
Today is Fri Jul 4 08:03:34 GMT 2008
2. [root @ jszwl161 sp49ep9] # echo "Today is 'date '"
Today is 'date'
3. [root @ jszwl161 sp49ep9] # echo "\\\\"
\\
4. [root @ jszwl161 sp49ep9] # echo "test" test ""
Test test
Reverse quotation marks
The objective is to keep Function Conversion within double quotes, but it does not work in single quotes.
1. [root @ jszwl161 sp49ep9] # echo "Today is 'date '"
Today is Fri Jul 4 08:03:34 GMT 2008 # convert the function date.
2. [root @ jszwl161 sp49ep9] # echo 'Today is 'date''
Today is 'date' # It does not work in single quotes.
Single quotes
The content enclosed by single quotes is considered as a single string. The $ symbol representing the variable in quotation marks does not work. That is to say, it is treated as a general symbol to prevent replacement of any variable.
Double quotation marks
The content enclosed by double quotation marks is considered as a single string. It prevents wildcard extension, but allows variable extension. This is different from how a single reference is processed.
Reverse quotation marks
The preceding single double quotes enclose strings. What if the string is a command column? The answer is no execution. To deal with this situation, we must use reverse single quotes.
Fdv = 'date + % F' echo "today $ fdv"
The date + % F in the inverted quotation marks is considered as an instruction, and the execution result is included in the fdv variable.
Address: http://kmoving.blog.163.com/blog/static/205049197201242211111682/