man.cgi源码

#! /bin/sh
eval `sh proccgi.sh $*`
echo "Content-type: text/html"
echo
echo
echo "<html>"
echo "<head>"
echo "<meta charset="UTF-8">"
echo "<title>shell-cgi实现man命令</title>"
echo "<style>"
echo "pre {margin:0 auto; width:"50%"; height:"100%"; font-size:12pt;}"
echo "</style>"
echo "</head>"
echo "<body>"
if man $FORM_command>/dev/null
then
echo "<pre>"
man $FORM_command
echo "</pre>"
else
echo "<p>对不起,没有查询到相关信息"
fi
echo "</body>"
echo "</html>"

  

html源码

<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>man for web</title>
<link rel="stylesheet" type="text/css" href="man.css"/>
<script type="text/javascript">
window.onload=function()
{
var submit=document.getElementById("submit");
submit.onclick=function(){
if(document.myform.command.value==""){
alert("你没有输入任何信息");
return false;
}
}
}
</script>
</head>
<body>
<div id="box">
<h1>man for web</h1>
<form method="post" action="/cgi-bin/man.cgi" name="myform">
<input type="text" placeholder="命令" name="command"></input>
<button class="but" type="submit" id="submit">确定</button>
</form>
</div>
</body>
</html>

  

man.css源码

html{
width: 100%;
height: 100%;
overflow: hidden;
}
body{
width: 100%;
height: 100%;
margin: 0;
background-color: #4A374A;
}
#box{
position: absolute;
top: 50%;
left:50%;
margin: -150px 0 0 -150px;
width: 300px;
height: 300px;
}
#box h1{
color: #fff;
letter-spacing: 1px;
text-align: center;
}
h1{
font-size: 2em;
margin: 0.67em 0;
}
input{
width: 278px;
height: 18px;
margin-bottom: 10px;
outline: none;
padding: 10px;
font-size: 13px;
color: #fff;
border-top: 1px solid #312E3D;
border-left: 1px solid #312E3D;
border-right: 1px solid #312E3D;
border-bottom: 1px solid #56536A;
border-radius: 4px;
background-color: #2D2D3F;
}
.but{
width: 300px;
min-height: 20px;
display: block;
background-color: #4a77d4;
border: 1px solid #3762bc;
color: #fff;
padding: 9px 14px;
font-size: 15px;
line-height: normal;
border-radius: 5px;
margin: 0;
}

效果图

proccgi.sh是在网上很容易找到,就不贴出源码了。它的作用是取得post过来的数据。

参考链接:

http://www.jb51.net/web/458871.html

shell脚本作为cgi程序--以web版man为例的更多相关文章

  1. 读《Linux Shell脚本攻略》(第2版) 总结

    前段时间读完了<Linux Shell脚本攻略>(第2版)这本书,给部分想读这本书的人分享下个人感受. 说下这本书的难度吧.纯新手或者只懂少部分编程知识的人,读起来还是有很大难度的.以我为 ...

  2. 读《Linux Shell脚本攻略》(第2版) 一遍、二遍体会

    前段时间读完了<Linux Shell脚本攻略>(第2版)这本书,给部分想读这本书的人分享下个人感受. 第一遍体会解读:就像黑夜中的灯塔,指明前进的道路. 推荐指数:强烈推荐. 书中讲解的 ...

  3. IDEA部署项目,并结合Shell脚本运行Java程序

    一.概述 在实际开发中,我们写好的代码,往往打成war包或jar包,通过winscp或其他软件将其上传至服务器,然而这样非常大的一个弊端就是不利于开发,为什么这么说呢?假如我们刚刚将springboo ...

  4. Linux简单Shell脚本监控MySQL、Apache Web和磁盘空间

    Linux简单Shell脚本监控MySQL.Apache Web和磁盘空间 1. 目的或任务 当MySQL数据库.Apache Web服务器停止运行时,重新启动运行,并发送邮件通知: 当服务器磁盘的空 ...

  5. shell脚本--初识CGI

    CGI按照百度百科的定义,如下: CGI 是Web 服务器运行时外部程序的规范,按CGI 编写的程序可以扩展服务器功能.CGI 应用程序能与浏览器进行交互,还可通过数据库API 与数据库服务器等外部数 ...

  6. 利用cgi编程实现web版man手册

    董老师前几天给我们布置了3道作业,第三道作业是cgi程序设计. 题目: web服务器cgi接口功能的实现 要求: 能调用cgi程序并得到返回结果: cgi程序能接受参数并得到返回结果: 使用两种或以上 ...

  7. shell脚本运行java程序jar

    在UBuntu上部署项目的时候,我们往往通过一段shell来启动程序,甚至是通过crontab定时任务来定时的调用java程序,但是很奇怪的一个问题就是,比如我写了一个如下的shell脚本: #!/b ...

  8. RDIFramework.NET V2.5(.NET快速信息化系统开发框架) Web版界面样例(可参考)

    RDIFramework.NET V2.5(.NET快速信息化系统开发框架)  Web版介绍 现已升级到V2.8,点击查看 B/S结构(Browser/Server,浏览器/服务器模式),是WEB兴起 ...

  9. shell脚本--编写CGI代码(shell结合html)以及环境变量

    实现shell和html标签混合的方式编写代码: 推荐  初始CGI ,看完大概之后,大概对cgi有个大体的印象.下面是编写混合代码的示例: #!/bin/bash #index.cgi echo & ...

随机推荐

  1. TL-WAR1200L V1.0升级软件20170609

         TL-WAR1200L_V1.0升级软件20170609.part1.rar  TL-WAR1200L_V1.0升级软件20170609.part2.rar TP-LINK WVR& ...

  2. leetcode 198打家劫舍

    讲解视频见刘宇波leetcode动态规划第三个视频 记忆化搜索代码: #include <bits/stdc++.h> using namespace std; class Solutio ...

  3. vue中检测敏感词,锚点

    当发布文章的时候,标题有敏感词 则检测有敏感词的接口成功的时候,写锚点 eg: _this .$alert("检测到标题有敏感词,请修改后再发布", "提示", ...

  4. 用log4net记录日志信息

    在.net中用log4net记录日志信息,已经是很平常的事情了. log4net下载:http://logging.apache.org/log4net/download_log4net.cgi 百度 ...

  5. nodejs中&#x5B89;&#x5353;&#x7AEF;的编码如何转换为中文

    借助一些模块来转换,比如,html-entities Github var Entities = require('html-entities').XmlEntities; entities = ne ...

  6. python pandas模块,nba数据处理(1)

    pandas提供了使我们能够快速便捷地处理结构化数据的大量数据结构和函数.pandas兼具Numpy高性能的数组计算功能以及电子表格和关系型数据(如SQL)灵活的数据处理能力.它提供了复杂精细的索引功 ...

  7. STL之Map和multimap容器

    1.Map和multimap容器 1)map是标准的关联式容器,一个map是一个键值对序列,即(key,value)对.它提供基于key的快速检索能力. 2)map中key值是唯一的.集合中的元素按一 ...

  8. golang linux安装

    go在linux下的安装: [root@localhost src]# wget https://storage.googleapis.com/golang/go1.8.1.linux-amd64.t ...

  9. 10 enumerate()在字典,列表中的用法详解

    1.字典 li = {"alex"," aric","Alex","Tony","rain"}for ...

  10. 更换tomcat运行日志目录

    1.在tomcat安装文件夹的bin目录下,修改catalina.sh,改变catalina.out的输出目录 CATALINA_OUT="$CATALINA_BASE"/logs ...