Single quotes enclose a value which is to be taken literally: all types of expansion are suppressed. Usually used if the value includes or may include white space (space, tab, new-line), or special characters (
` ) that the user does not want to be expanded/treated specially by the shell.
Double quotes enclose a value which will have variables, and character replacement done. Required when the output may contain whitespace, and must be assigned as a single value.
Back quotes enclose a command, the results of which are wanted as value. Newer shells allow the use of
$(...) in place of
`...`. I prefer the newer method.
The following code may help understand what is happening.
echo sq: $CMD
echo raw 1: $1
echo raw: $*
echo dq: $1
echo bq: `$CMD`
echo new: $($CMD)