Writing the HTML code in Shell Scripts


You can use HTML code inside shell scripts. For example, a well-formed HTML file contains the following information:

HTML>
<HEAD>
    <TITLE>
    Title of the Page
    </TITLE>
</HEAD>
 
<BODY>
    Our content information goes here
</BODY>
</HTML>



Now, using a shell script we produce the above information:



#!/bin/bash
 
# Create_page - This script will produce an HTML file
 
cat <<- _EOF_
    <HTML>
    <HEAD>
        <TITLE>
        Title of the Page
        </TITLE>
    </HEAD>
 
    <BODY>
        Our content information goes here
    </BODY>
    </HTML>
_EOF_
Changing the "<<" to "<<-" causes bash to ignore the leading white space in the script. The output from the cat command will not contain any of the leading spaces or tab characters.




Added on August 30, 2008 Comment
}