Shell quotes 1. double quotation marks $, ', \, reserved for special purpose. Note that [root @ Centos5test] # echo & quot; \ n & quot; is supported by the escape character "\ n" by default when echo is not added; \ n [root @ Centos5test] # [root @ Centos5test] # printf & quot; \ n & quot ;...
Quotes in shell
1. double quotation marks
$, ', \, Retain special meaning
Note that escape characters such as \ n are not supported by default when echo is not added.
Supported by printf
[Root @ Centos5 test] # echo "\ n"
\ N
[Root @ Centos5 test] #
[Root @ Centos5 test] # printf "\ n"
[Root @ Centos5 test] #
Note that special characters echo "\ Special characters" are referenced in double quotation marks"
# Special characters $ '\ "are known in double quotes
Echo "\""
"
Echo "\ $"
$
2. single quotes
The referenced character is interpreted as the surface meaning of the character.
Note that escape characters such as \ n are interpreted in both single quotes and double quotes during echo-e.
Escape tables
\ A \ B \ c \ f \ n \ t \ r \ v
# Do not confuse with \ $
[Root @ Centos5 test] # echo-e "\ n"
[Root @ Centos5 test] #
[Root @ Centos5 test] # echo-e '\ n'
[Root @ Centos5 test] # echo-e '\"'
\"
Then
[Root @ Centos5 test] # echo-e '\'
\
[Root @ Centos5 test] # echo-e '\\'
\
[Root @ Centos5 test] # echo \
>
Don't be confused.
3. unified symbol
Do not use it *? [] | ^. If no match is found, it is interpreted as itself.
[Root @ Centos5 test] # ls *. 111
Ls: *. 111: No such file or directory
4. escape \, \ the next character is interpreted as literal
Echo \*
*
Echo \\
\
5. shell metacharacter meta
IFS
CR
=
$
>
<| & () {}; & |!
# Escape these characters when they are not referenced
Echo \ =
=
I don't know about some output, so I will try it. The results will come out several times.
This article is from the blog "The gentleman is knowledgeable and the Japanese ginseng saves himself ...".