Differences between version 2 and previous revision of HereDocuments.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Monday, November 11, 2002 11:05:36 am | by CraigBox | Revert |
Older page: | version 1 | Last edited on Monday, November 11, 2002 11:04:47 am | by CraigBox | Revert |
@@ -26,13 +26,9 @@
%%%
Why would you use such a thing? For documentation, compare:
-| cat << EOF | cat
foo bar
-|
foo bar | cat
foo bar
-
| foo bar |
cat foo bar foo
-|
foo bar foo |
-| EOF |
+| cat << EOF %%%
foo bar %%%
foo bar %%%
foo bar foo %%% EOF
| cat
foo bar %%%
cat foo bar %%% cat
foo bar foo
Then compare that in a twenty line block. Makes writing the documentation easier and checking it painless (did you mean to mention 'cat' at the beginning of a line and your mind skipped over it because all the lines began with cat?)
Another very important use is automating commands such as FTP that don't otherwise provide a method for scripting;