Shell provides a reference mechanism to selectively avoid unwanted extensions.
Introduction
Shell provides a reference mechanism to selectively avoid unwanted extensions.
============================================
Double quotation marks
If the text is placed in double quotation marks, all special characters used by shell will lose their special meaning and be considered as common characters.
Except for characters $ (dollar sign), \ (backslash), and '(quotation marks.
This means that the path extension, wave first extension, and curly braces extension will all expire. However, parameter extension, arithmetic extension, and command replacement are valid.
Example 1 (the PATH extension is invalid)
[Root @ allyes20121031 de_info_center] # echo "*"
*
Example 2 (effective command replacement)
[Root @ allyes20121031 de_info_center] # echo "$ (ls )"
2. txt
Argv. cpp
Argv. h
Config. cpp
Double quotation marks are applicable when the file name contains white spaces.
Assume that there is unfortunately a file named two words.txt. If this file name is used in the command line, the word segmentation function treats them as two independent parameters.
Double quotation marks can prevent word segmentation.
============================================
Single quotes
If we want to suppress all extensions, we should use single quotes.
For example
[Root @ allyes20121031 de_info_center] # echo "$ (ls )"
2. txt
Argv. cpp
Argv. h
Config. cpp
[Root @ allyes20121031 de_info_center] # echo '$ (ls )'
$ (Ls)
[Root @ allyes20121031 de_info_center] #
============================================
Escape characters
Sometimes we just want to reference a single referenced character. In this case, you can add a backslash before the character.
For example
[Root @ allyes20121031 de_info_center] # echo "$ (ls )"
2. txt
Argv. cpp
Argv. h
Config. cpp
[Root @ allyes20121031 de_info_center] # echo "\ $ (ls )"
$ (Ls)
[Root @ allyes20121031 de_info_center] #
Escape characters are also used to remove the special meaning of a character in a file name.
These characters include "$" and ","! "," & ", And space.
============================================