#!/bin/bash # Sample script to demonstrate the creation of an HTML report using shell scripting # Web directory WEB_DIR=$1 REPORT_FILE=$WEB_DIR/filesystem_report.html # A little CSS and table layout to make the report look a little nicer echo "
" > $REPORT_FILE # View hostname and insert it at the top of the html body HOST=$(hostname -f) echo "Filesystem usage for host $HOST| Filesystem | Size | Use % |
|---|---|---|
| " >> $REPORT_FILE echo $line | awk '{print $1}' >> $REPORT_FILE echo " | " >> $REPORT_FILE echo $line | awk '{print $2}' >> $REPORT_FILE echo " | " >> $REPORT_FILE echo $line | awk '{print $5}' >> $REPORT_FILE echo " |