Debian Codegraph @

ex71c.sh

raw symbols SCIP
1 #!/bin/bash
2 # A 'cat' here-document, but with parameter substitution disabled.
3
4 NAME="John Doe"
5 RESPONDENT="the author of this fine script"
6
7 cat <<'Endofmessage'
8
9 Hello, there, $NAME.
10 Greetings to you, $NAME, from $RESPONDENT.
11
12 Endofmessage
13
14 # No parameter substitution when the "limit string" is quoted or escaped.
15 # Either of the following at the head of the here document would have
16 #+ the same effect.
17 # cat <<"Endofmessage"
18 # cat <<\Endofmessage
19
20
21
22 # And, likewise:
23
24 cat <<"SpecialCharTest"
25
26 Directory listing would follow
27 if limit string were not quoted.
28 `ls -l`
29
30 Arithmetic expansion would take place
31 if limit string were not quoted.
32 $((5 + 3))
33
34 A a single backslash would echo
35 if limit string were not quoted.
36 \\
37
38 SpecialCharTest
39
40
41 exit