I have a script in which some html code is created with information about my system. What I would like is to have the html code automatically written to a file.
Here is the script
# make_page - A script to produce an HTML file
TITLE="My System Information for $HOSTNAME"
RIGHT_NOW=$(date +"%x %r %Z")
TIME_STAMP="Updated on $RIGHT_NOW by $USER"
echo "<h2>System release info</h2>"
echo "<p>Function not yet implremented</p>"
echo "<h2>System uptime</h2>"
echo "<h2>Filesystem space</h2>"
# Only the superuser can get this information
if [ "$(id -u)" = "0" ]; then
echo "<h2>Home directory space by user</h2>"
echo "Bytes Directory"
du -s /home/* | sort -nr
# end of the home_space
cat <<- _EOF_
I tried putting the section of the script that contains the html code starting at "cat <<- all the way to _EOF_"
in a function first and then calling that function to write it's contents into a file and when I couldn't get that to work I tried making the html code a variable and then writing that into a file and was not successful.
I can do what I want outside of the script: make_page > page.html
I just can't do it within the script.