Debian Codegraph @

ex71.sh

raw symbols SCIP
1 #!/bin/bash
2
3 # 'echo' is fine for printing single line messages,
4 #+ but somewhat problematic for for message blocks.
5 # A 'cat' here document overcomes this limitation.
6
7 cat <<End-of-message
8 -------------------------------------
9 This is line 1 of the message.
10 This is line 2 of the message.
11 This is line 3 of the message.
12 This is line 4 of the message.
13 This is the last line of the message.
14 -------------------------------------
15 End-of-message
16
17 # Replacing line 7, above, with
18 #+ cat > $Newfile <<End-of-message
19 #+ ^^^^^^^^^^
20 #+ writes the output to the file $Newfile, rather than to stdout.
21
22 exit 0
23
24
25 #--------------------------------------------
26 # Code below disabled, due to "exit 0" above.
27
28 # S.C. points out that the following also works.
29 echo "-------------------------------------
30 This is line 1 of the message.
31 This is line 2 of the message.
32 This is line 3 of the message.
33 This is line 4 of the message.
34 This is the last line of the message.
35 -------------------------------------"
36 # However, text may not include double quotes unless they are escaped.