Difference between double quote and single quote

suggest change
Double quotes Single quotes
Allow variable expansion Prevent variable expansion
Allow history expansion if enabled Prevent history expansion
Allow command substitution Prevent command substitution
$* and $@ can have special meaning * and @ are always literals
Can contain both single quotes and double quotes A single quote is not allowed inside single quotes
$, `, ", and \ can be escaped with \ All of those 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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents