Double quote | Single quote |
---|---|
Allows variable expansion | Prevents variable expansion |
Allows history expansion if enabled | Prevents history expansion |
Allows command substitution | Prevents command substitution |
* and @ can have special meaning | * and @ are always literals |
Can contain both single quote or double quote | Single quote is not allowed inside single quote |
$ , ` , " , \ can be escaped with \ to prevent their special meaning | All of them are literals |
Properties that are common to both:
Examples:
$ echo "!cat"
echo "cat file"
cat file
$ echo '!cat'
!cat
echo "\"'\""
"'"
$ a='var'
$ echo '$a'
$a
$ echo "$a"
var