将 unix os 命令的外部重定向到 html 页面
Redirect Outward of unix os commands to html page
如何将 unix os 命令重定向并导出到 HTML 页面?
尝试这样的事情(使用命令 ls):
# start the html file
echo "<html lang="en"><head><title>Command Output</title></head><body><table>" > output.html
# get the data needed to a file for processing
ls -lah >> output.html
# escape html entities with PHP (optional but recommended)
cat output.html | php -R 'echo html_entity_decode($argn);' > output2.html
# enclose each line in a html table row
while read line; do echo "<tr><td>$line</tr></td>"; done < output2.html > output3.html
# finish the file with the html closing tags
echo "</table></body></html>" >> output2.html
如何将 unix os 命令重定向并导出到 HTML 页面?
尝试这样的事情(使用命令 ls):
# start the html file
echo "<html lang="en"><head><title>Command Output</title></head><body><table>" > output.html
# get the data needed to a file for processing
ls -lah >> output.html
# escape html entities with PHP (optional but recommended)
cat output.html | php -R 'echo html_entity_decode($argn);' > output2.html
# enclose each line in a html table row
while read line; do echo "<tr><td>$line</tr></td>"; done < output2.html > output3.html
# finish the file with the html closing tags
echo "</table></body></html>" >> output2.html