" - double quotes.
Quotes blanks (spaces and tabs)
greet="hey there"
echo $greet
Allows variable expansion.
biggreet="$greet everyone"
echo "$biggreet"
Suppresses filename wild cards.
echo * # shows all the names in current directory
echo "*" # shows a *
Useful when passing filename wild card as an argument.
find . -name "fn*"
Quotes single quotes.
echo "She's mine"
She's mine
Allows command substitution, ` grave and $() (see below)
list="These are my a files : $(ls a*)"
These are my a files : assn02 assn02l1 assn1.txt
' - single quotes.
Quotes double quotes.
echo 'Got "The Best" deal'
Got "The Best" deal
Suppresses variable expansion.
echo '$biggreet'
$biggreet
Suppresses filename wild cards.
Suppresses the command substitutions ` and $()
list='These are my a files : $(ls a*)'
These are my a files : $(ls a*)
\ - escape quote or back-slash.
Escapes single characters. Useful when you need a single single or double
quote character or you need quotes inside quotes.
echo She\'s mine
She's mine
echo "I'm \"Here\""
I'm "Here"
[ctrl]v - ctrl quote.
Escapes other control characters and some other characters such as tab.
[ctrl]v[ctrl]m - control escapes carriage feed.
Command substitution
` - grave quote. Also available in c-shell and others.
Executes command inside of graves and replaces command with output
in current line.
Most command-line evaluation will be applied to command sequence quoted.
However, grave substitution is deprecated in bash and may disappear
in further versions.
num1=7;num2=9;echo "expr $num1 + $num2 = `expr $num1 + $num2`"
$() - command substitution - bash specific.
Executes command inside $( ).
$() has the advantage of being able to be nested.
echo ls > cmd1 # put command in file.
echo cmd1 > cmd2
$(cat $(cat cmd2))
var=$($(cat $(cat cmd2)))
echo $var
Note : While you can use variable references in the sequence, they are
generally evaluated first so usually useful on for the inner-most $()
More detailed discussion in "quotes" module.
Also :
http://www.tldp.org/LDP/abs/html/commandsub.html