Tag: Shell
In Shell, some symbols are processed differently under different definitions. There are three main methods to define them:
(1) single quotes
(2) double quotation marks
(3) reverse quotation marks
Double quotation marks and single quotation marks are the most common ones. For these two symbols, the difference between them can be clearly indicated using the $ variable, as shown below:
[[Email protected] ~] $ Echo 'home is $ home'
Home is $ home
[[Email protected] ~] $ Echo "Home is $ home"
Home is/home/Map
We can clearly sum up the rule that $ home is regarded as a string in single quotes, $ home in double quotes is regarded as a variable and expanded to its actual value.
Next we will talk about the anti-quotation marks. This symbol is "'", which is the key under ESC. Let's look at a small example:
[[Email protected] ~] $ Whoami
Map
[[Email protected] ~] $ Echo 'whoam'
Map
We can also clearly sum up the rule that the content defined by the anti-quotation marks is treated as a shell command, and its content is automatically replaced by the output of the command during execution.