September 2018
Beginner
186 pages
4h 30m
English
Double quotes behave similarly to single quotes, but they perform certain kinds of expansion within them, for shell variables and substitutions. This can be used to include the value of a variable as part of a literal string:
$ echo "This is my login shell: $SHELL" This is my login shell: /bin/bash
Compare this to the literal output of single quotes:
$ echo 'This is my login shell: $SHELL' This is my login shell: $SHELL
Other kinds of parameter expansion within double quotes are possible, which we will examine in later chapters.
You can include a literal dollar sign or backslash in a string by escaping it:
$ echo "Not a variable: \$total" Not a variable: $total $ echo "Back\\to\\back\\slashes" Back\to\back\slashes
Exclamation ...
Read now
Unlock full access