C.3. Double Quotes

  1. Must be matched.

  2. Protect all metacharacters from interpretation except the following:

    1. Itself.

    2. Exclamation point (csh only).

    3. $ used for variable substitution.

    4. ' ' Backquotes for command substitution.

Examples:

C Shell Bourne Shell Korn Shell
echo "Hello $LOGNAME\!" echo "Hello $LOGNAME!" print "Hello $LOGNAME!"
echo "I don't care" echo "I don't care" print "I don't care"
echo "The date is 'date'" echo "The date is 'date'" print "The date is $(date)"
echo "\\\\" echo "\\\\" print "\\\\"
\\\\\\

Get UNIX® Shells by Example, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.