Shell编程WEB界面展示实践

操作系统:win7

虚拟机:Virtual box with Ubuntu13.10

WEB服务器: Nginx

WEB服务器发布目录:/usr/local/nginx/html/c 

测试文件:list.txt

Shell编程WEB界面展示实践_第1张图片

步骤:

1.新建一个shell脚本文件auto_html.sh.编辑内容如下:

#!/bin/bash
# created by bing

HTML=index.html
cat >$HTML < #HTML格式



this is a test page[A]



EOF
while read line
do
ID=`echo $line|awk '{print $1}'`

IP=`echo $line |awk '{print $2}'`
NAME=`echo $line |awk '{print $3}'`

echo "

" >>$HTML

done < list.txt                                        #测试文件

cat >>$HTML <#HTML格式

IDIP addressDNS Name
$ID$IP$NAME




EOF

2.运行脚本./auto_html

 

3.查看生成的index.html

Shell编程WEB界面展示实践_第2张图片

 

 4.配置本地hosts文件

 Shell编程WEB界面展示实践_第3张图片

5.启动Nginx 服务器

 

6.浏览器中输入网址http://www.test.com

Shell编程WEB界面展示实践_第4张图片

 

你可能感兴趣的:(Shell编程WEB界面展示实践)