Single quote ignores all the special characters while double quote ignores most. The following three characters are not ignored by double quotes. They are Dollar sign $, back quote `, and backslash \ .
Here is the example:
$i='* is an asterisk"
$echo "$i"
* is an asterisk
Shell ignores any special meaning attached to a character by using a backslash before this character.
$i=>
-ksh: syntax error: `new line` unexpected
$i=\>
$echo $i
>
When processing a long command, backslash can also be used for continuing lines.
$i=one\
>two
$echo $i
onetwo
Back quote tells shell to execute the command enclosed by it. However, it's an old command and not preferred for use.+
$echo current date is `date`
current date is Wed Apr 16 13:02:59 CEST 2014
Instead of Back quote, we use $(...) construct to substitute command and output to the command line.
$echo current date is $(date)
current date is Wed Apr 16 13:02:59 CEST 2014
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13738922/viewspace-1143554/ ,如需转载,请注明出处,否则将追究法律责任。