码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本--编写CGI代码

时间:2018-03-14 12:46:39      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:ref   推荐   www.   logs   info   image   color   html   分享   

  推荐  初始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

  

 

shell脚本--编写CGI代码

标签:ref   推荐   www.   logs   info   image   color   html   分享   

原文地址:https://www.cnblogs.com/-beyond/p/8566379.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!