0
如何重定向並將unix os命令導出到HTML頁面?將unix os命令向外發送到html頁面
如何重定向並將unix os命令導出到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
感謝您的答覆,我actully需要的是重定向-ls是在HTML格式
我編輯了我的答案,它應該做你現在說的話! – CrazyMenConnected
相關問題