[英]create html file in shell script
How do we create html file in shell script?我们如何在 shell 脚本中创建 html 文件?
I tried the below code我试过下面的代码
echo "<html>"
echo "<head>"
echo "<style type=\"text/css\">"
echo "table{background-color:#DCDCDC}"
echo "thead {color:#708090}"
echo "tbody {color:#191970}"
echo "</style>"
echo "</head>"
echo "<body>"
echo "<table border=\"1\">"
echo "<thead>"
echo "<tr width="100" bgcolor='#C0C0C0'><center><td colspan="3"><font color="#000000"><b>CONSOLIDATED RUNBOOK</b></font></center></td>"
echo "</h4>"
echo "</tr>"
echo "<tr>"
echo "<th><col width="100"><font color="000000">APP NAME</font></th>"
echo "<th><col width="100"><font color="000000">STATUS</font></th>"
echo "<th><col width="100"><font color="000000">STATUS AS ON</font></th>"
echo "</tr>"
>> text.html
I am trying to create html file with the help of shell script.我正在尝试借助 shell 脚本创建 html 文件。 Can you please help>
你能帮忙吗>
{
echo "<html>"
echo "<head>"
echo "<style type=\"text/css\">"
echo "table{background-color:#DCDCDC}"
echo "thead {color:#708090}"
echo "tbody {color:#191970}"
echo "</style>"
echo "</head>"
echo "<body>"
echo "<table border=\"1\">"
echo "<thead>"
echo "<tr width="100" bgcolor='#C0C0C0'><center><td colspan="3"><font color="#000000"><b>CONSOLIDATED RUNBOOK</b></font></center></td>"
echo "</h4>"
echo "</tr>"
echo "<tr>"
echo "<th><col width="100"><font color="000000">APP NAME</font></th>"
echo "<th><col width="100"><font color="000000">STATUS</font></th>"
echo "<th><col width="100"><font color="000000">STATUS AS ON</font></th>"
echo "</tr>"
}>> text.html
You could use a heredoc instead:您可以改用heredoc :
cat > text.html <<EOF
<html>
<head>
<style type=\"text/css\">
table{background-color:#DCDCDC}
thead {color:#708090}
tbody {color:#191970}
</style>
</head>
<body>
<table border=\"1\">
<thead>
<tr width="100" bgcolor='#C0C0C0'><center><td colspan="3"><font color="#000000"><b>CONSOLIDATED RUNBOOK</b></font></center></td>
</h4>
</tr>
<tr>
<th><col width="100"><font color="000000">APP NAME</font></th>
<th><col width="100"><font color="000000">STATUS</font></th>
<th><col width="100"><font color="000000">STATUS AS ON</font></th>
</tr>
EOF
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.