1. Shell uses quotation marks (single quotation marks/double quotation marks) and backslash ("\") for the shell interpreterSHIELD special characters.
Reverse quotation marks [H2] have special significance for shell.
1.1 single quotes and backlash [H1] can prevent shell from being substituted into variable values;
1.2 double quotation marks cannot prevent substitution
For example:
Sles10i32-1: Han $ person = Han
Sles10i32-1: Han $ echo $ person
Han
Sles10i32-1: Han $ echo "$ person"
Han
Sles10i32-1: Han $ echo '$ person'
$ Person
Sles10i32-1: Han $ echo \ $ person
$ Person
- Like single quotes, The backslash can also block all special characters. However, it can only block one character at a time, rather than a group of characters.
- The anti-quotation mark function is different from the above three symbols. It does not have the function of shielding special characters. However, you can pass the running result of a command to another command.
Example:
Sles10i32-1: Han $ PWD.
/Users/Han
Sles10i32-1: Han $ echo 'pwd'
/Users/Han
[H1] The backslash can only block one character
[H2] in the upper left corner of the keyboard, and ~ Public a key.