Including text in a shell script

Text can be included in the shell script by using a here document, a special form of input redirection.

The << symbol is used to indicate that text should be read up to a given mark. For example:

   #!/bin/sh
   # this script outputs the given text before it runs
   cat << EOF
   This shellscript is currently under development, please
   report any problems to Danny (danny@cornflake.ed)
   EOF
   exec /usr/local/test/bin/test_version

The text is read from the script until a pattern is found which matches that after the << symbol; execution then proceeds as normal.


[Home] [Index]