Para simplificar o corpo, você pode usar algo assim:
df -Ph | awk -f stat.awk
Eu extraí as partes do awk em um script do awk, mas o script pode ser facilmente embutido.
Onde stat.awk é:
BEGIN {
print "<html><body><table border=\"8\" cellpadding=\"3\" style=\"border-collapse: collapse\">"
print "<tr>"
print "<th bgcolor=turquoise colspan="6">BEFORE_USAGE</th>"
print "</tr>"
print "<tr>"
print "<th bgcolor=gray>MOUNT</th>"
print "<th bgcolor=gray>SIZE</th>"
print "<th bgcolor=gray>USED</th>"
print "<th bgcolor=gray>AVAILABLE</th>"
print "<th bgcolor=gray>USE%</th>"
print "</tr>"
}
NR > 1 {
bgcolor=""
if ($5+0 > 70) {
bgcolor=" bgcolor=azure"
}
print "<tr><td>"$6"</td><td>"$2"</td><td>"$3"</td><td>"$4"</td><td"bgcolor">"$5"</td></tr>"
}
END {
print "</table></body></html>"
}
Para mim, isso produz:
<html><body><table border="8" cellpadding="3" style="border-collapse: collapse">
<tr>
<th bgcolor=turquoise colspan=6>BEFORE_USAGE</th>
</tr>
<tr>
<th bgcolor=gray>MOUNT</th>
<th bgcolor=gray>SIZE</th>
<th bgcolor=gray>USED</th>
<th bgcolor=gray>AVAILABLE</th>
<th bgcolor=gray>USE%</th>
</tr>
<tr><td>/</td><td>465Gi</td><td>402Gi</td><td>62Gi</td><td bgcolor=azure>87%</td></tr>
<tr><td>/dev</td><td>339Ki</td><td>339Ki</td><td>0Bi</td><td bgcolor=azure>100%</td></tr>
<tr><td>/Volumes/MobileBackups</td><td>465Gi</td><td>465Gi</td><td>0Bi</td><td bgcolor=azure>100%</td></tr>
<tr><td>/Volumes/Transcend</td><td>120Gi</td><td>62Gi</td><td>57Gi</td><td>53%</td></tr>
<tr><td>/Volumes/LaCie</td><td>3.6Ti</td><td>701Gi</td><td>3.0Ti</td><td>19%</td></tr>
</table></body></html>
Por favor, note que esta solução quebra quando seus nomes de volume contêm espaços.