mirror of https://github.com/tLDP/LDP
42 lines
783 B
Bash
42 lines
783 B
Bash
#!/bin/bash
|
|
# A 'cat' here-document, but with parameter substitution disabled.
|
|
|
|
NAME="John Doe"
|
|
RESPONDENT="the author of this fine script"
|
|
|
|
cat <<'Endofmessage'
|
|
|
|
Hello, there, $NAME.
|
|
Greetings to you, $NAME, from $RESPONDENT.
|
|
|
|
Endofmessage
|
|
|
|
# No parameter substitution when the "limit string" is quoted or escaped.
|
|
# Either of the following at the head of the here document would have
|
|
#+ the same effect.
|
|
# cat <<"Endofmessage"
|
|
# cat <<\Endofmessage
|
|
|
|
|
|
|
|
# And, likewise:
|
|
|
|
cat <<"SpecialCharTest"
|
|
|
|
Directory listing would follow
|
|
if limit string were not quoted.
|
|
`ls -l`
|
|
|
|
Arithmetic expansion would take place
|
|
if limit string were not quoted.
|
|
$((5 + 3))
|
|
|
|
A a single backslash would echo
|
|
if limit string were not quoted.
|
|
\\
|
|
|
|
SpecialCharTest
|
|
|
|
|
|
exit
|