Difference between single and double quotes in Bash
bash, double-quotes, quotes, shell, single-quotes
Solution
Single quotes won't interpolate anything, but double quotes will. For example: variables, backticks, certain `\` escapes, etc.
Example:
$ echo "$(echo "upg")"
upg
$ echo '$(echo "upg")'
$(echo "upg")
The Bash manual has this to say:
3.1.2.2 Single Quotes
Enclosing characters in single quotes (`'`) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.
3.1.2.3 Double Quotes
Enclosing characters in double quotes (`"`) preserves the literal value of all characters within the quotes, with the exception of `$`,
, `\`, and, when history expansion is enabled, `!`. The characters `$` and retain their special meaning within double quotes (see Shell Expansions). The backslash retains its special meaning only when followed by one of the following characters: `$`,
The special parameters `*` and `@` have special meaning when in double quotes (see Shell Parameter Expansion).Problem
In Bash, what are the differences between single quotes (`''`) and double quotes (`""`)?