[Linux] shell, the application of anti-quotation marks ('), linuxshell
The quotation mark (') is located at the top of the Tab key of the keyboard and the left side of the key 1. Note the difference between it and the single quotation mark (') on the left side of the Enter key.
The reverse quotation mark (') is used to replace commands in Linux. Command replacement means that shell can insert the standard output of a command to any location in a command line.
For example:
Cl @ cl-OptiPlex-380 :~ $ Date October 29, 2014 15:14:46 CSTcl @ cl-OptiPlex-380 :~ $ Echo 'date' | cut-d'-f1-4 Wednesday, October 29, 2014
We can see that the date command in the back quotes ''is executed first, and then the date command output is replaced with the corresponding position.
Very valid metacharacters are often used in shell.
In the embedded linux shell, reverse quotation marks are not supported. How can this problem be solved?
If the shell is faulty and does not support this symbol, you need this string.
Date + % s | read tm
Echo $ tm
How to deal with single quotes, double quotation marks, and reverse quotation marks in shell
Single quotes: All delimiters are closed, and the content in the brackets is complete.
Double quotation marks: Some escape characters are closed, but some are retained (for example, $)
Anti-quotation marks: use it as a system command and execute it.