The quoting (reference) in the shell can be used to remove the special meaning of a character so that it retains its literal meaning and can be used for a variety of shell Expansion.
There are 3 kinds of quoting mechanisms: escape characters, single quotes, and double quotes.
1. Escape character
A non-referenced backslash ' \ ' is called an escape character, and it retains the literal meaning of the subsequent single character (removing the special meaning). With the exception of the backslash as the last character of the input line, the shell treats it as a continuation character, removes the subsequent newline character, and does not use the newline character as the delimiter for the parameter, as if the character had not occurred.
2. Single quotation marks
All the characters in the single quote ' ' will retain their literal meaning. Note that a single quotation mark cannot appear in the middle of a two single quotation mark, even if it is preceded by a backslash.
3. Double quotes
Double quotes in addition to the 4 characters ' $ ', ' ', ' \ ' and '! ' Outside, the others remain literal (note that the shell is in POSIX mode, '! ') also maintain literal meaning).
The characters ' $ ' and ' will carry out shell Expansion (such as variable expansion, command substitution, etc.).
Backslash ' \ ' in ' $ ', ' ', ' ' ', ' \ ', and newline in front, it will be removed, followed by the character unchanged, meaning literal.
In the expansion, '! ' You need to add ' \ ' before you can suppress the extension, and ' \ ' will not be removed.
Also, to understand the special ansi-c quoting, in the form of $ ' string ', the backslash ' \ ' in string and subsequent characters will be escaped in accordance with ANSI C standard, the result is like the ' $ ' symbol does not exist, only use single quotation marks. How to use ansi-c quoting, see in bash programming the variable has the Matchless quotation mark Quest.
If interested, you can follow the subscription number "database Best practices" (Dbbestpractice).
Quoting in the shell