19 Jan 2010

Simple html script

Author: admin | Filed under: General Info

Here is a little script I came across to create a simple html document on the fly;

touch http.sh
vim http.sh

Insert this code into the new script and modify as needed (it can be as simple of as complex as you would like!)

#!/bin/bash
# make_page - A script to produce a basic HTML file

echo "<html>"
echo "<head>"
echo "  <title>"
echo "  The title of your page"
echo "  </title>"
echo "</head>"
echo ""
echo "<body>"
echo "  Your page content goes here."
echo "</body>"
echo "</html>"

now save and close the new script. In Vim use

:wq

then

chmod +x http.sh

to make it executable then

./http.sh > mypage.html

to run the script. It will create the file mypage.html. You can modify this script to include any level of complexity you wish.

Leave a Reply