bash讀取txt檔案, 並在瀏覽器中以表格形式輸出
阿新 • • 發佈:2018-12-14
例如文字 data.txt
1 201623210021 wangzhiguo 25
2 201623210022 yangjiangbo 26
3 201623210023 yangzhen 24
4 201623210024 wangdong 23
5 201623210025 songdong 25
#!/bin/bash echo HTTP/1.0 200 OK echo Content-type: text/html echo "<html>" ..... echo "</head><body>" echo "<table>" cat data.txt | while read index number name age do echo "<tr>" echo "<td>${index}</td>" echo "<td>${number}</td>" echo "<td>${name}</td>" echo "<td>${age}</td>" echo " <tr>" done echo "</table>"