推荐 初始CGI ,看完大概之后,大概对cgi有个大体的印象。下面是在cgi脚本中实现shell和html标签混合的方式编写代码:
#!/bin/bash #index.cgi echo "Content-Type:text/html;charset=utf-8" echo echo ‘<html>‘ echo "<head>" echo "<title>" echo "hello world" echo "</title>" echo "</head>" echo "<body>" echo ‘<pre>‘ df -Th echo ‘<pre>‘ echo "</body>" echo "</html>"
浏览器访问:

将上面代码简化一下:
#!/bin/bash
#index.cgi
echo "Content-Type:text/html;charset=utf-8"
echo
cat << AAA
    <html>
    <head>
        <title>hello world</title>
    </head>
    <body>
    <pre>
AAA
 df -Th
cat << AAA
    </pre>
    </body>
    </html>
AAA