LDP/LDP/guide/docbook/abs-guide/ex71.sh

37 lines
1.1 KiB
Bash
Raw Normal View History

2001-07-10 14:25:50 +00:00
#!/bin/bash
2004-01-05 13:20:57 +00:00
# 'echo' is fine for printing single line messages,
2016-10-24 12:35:09 +00:00
#+ but somewhat problematic for message blocks.
2004-01-05 13:20:57 +00:00
# A 'cat' here document overcomes this limitation.
2001-07-10 14:25:50 +00:00
cat <<End-of-message
-------------------------------------
This is line 1 of the message.
This is line 2 of the message.
This is line 3 of the message.
This is line 4 of the message.
This is the last line of the message.
-------------------------------------
End-of-message
2004-01-26 00:03:37 +00:00
# Replacing line 7, above, with
#+ cat > $Newfile <<End-of-message
#+ ^^^^^^^^^^
#+ writes the output to the file $Newfile, rather than to stdout.
2001-07-10 14:25:50 +00:00
exit 0
#--------------------------------------------
# Code below disabled, due to "exit 0" above.
# S.C. points out that the following also works.
echo "-------------------------------------
This is line 1 of the message.
This is line 2 of the message.
This is line 3 of the message.
This is line 4 of the message.
This is the last line of the message.
-------------------------------------"
# However, text may not include double quotes unless they are escaped.