First shell script in my life

上一篇 / 下一篇  2011-04-01 09:35:32 / 个人分类:语言脚本

 

The  script. is very simpleness.My  intent is:look at here

http://www.51testing.com/index.php?uid-314982-action-viewspace-itemid-232574

-----------------

First file:function_plsql

-----------------------------------------------------------

#!/bin/bash
function  sqlresult()
{
eval $1=`sqlplus -S /nolog <<EOF
set heading off feedback off pagesize 0 verify off echo off numwidth 4
conn $2/zdsoft
$3
exit
EOF`
}

-----------------------------------------------------------

But when the return value $1 have blank(空格),the function will error.

I have no idea how to amend,somebody can help me ?

So i use a new way by compare file :

-----------------------------------------------------------

Second file:file_plsql.sh

#!/bin/bash
sqlplus /nolog << EOF
conn $1/zdsoft
$2
EOF

----------------------------------------------------------

Third file:start_case.sh

#!/bin/bash
#version:szxy3.0,tool
#date:2011-03-28
#name:pig
echo "正在执行,请等待>>>>>>"
#加载函数
source function_plsql

#域名等变量
#行政区码
canton=33
#系统参数初始化
passport_url=""
member_url=""
firstpage_url=""
fileserver_url=""
filephysics_prxfix="/opt/data"
message_port=5531
#项目部署初始化
deploy_fashion=2
cooperate_type=1
cooperate_name="中国移动"
#应用列表
office_url=""
data_eis_url=""
study_eis_url=""
personnel_eis_url=""
#等等后补
ess_url=""
port=8383
agreement="http"
#顶级单位
eis_unit_name=""
eis_user_real_name="pig"
eis_username=""
eis_password="12345678"
unit_type="教育局"
supply_unit="移动"
supply_code=04
supply_nullah_code=19
unit_nullah_code=10019
region_code=210000
#运营账号
ess_username=""
ess_password="12345678"
ess_realname="pige"

#演示地区
#省略

 


#测试用例,以步骤为顺序,以表为单位
#系统参数初始化
#base_sys_option
sql="select now_value from base_sys_option where id='17dce17ff1c343e3ac98e0df33f186dc';"
sqlresult rebase base1 "$sql"
if [ "$rebase" = "$passport_url" ]; then
echo "pass">>log_last.txt
else echo $sql>>log_last.txt
fi

sqlresult reeis eis1 "$sql"
if [ "$reeis" = "$rebase" ];then
echo "pass">>log_last.txt
else $sql>>log_last.txt
fi


sql="select id,name from sys_cooperator;"
./file_plsql.sh passport1 "$sql" >>logs/log_syscoo.txt
sql="select id,name from base_cooperator;"
./file_plsql.sh base1  "$sql" >>logs/log_basecoo.txt
diff logs/log_syscoo.txt logs/log_basecoo.txt >>log_last.txt

#这里还有大量的test case没写,但是样式同上,暂时省略.......

echo ">>>>运行完毕,请查看log_last.txt"

--------------

./start_case.sh

--------------

 

 

 


TAG:

 

评分:0

我来说两句

日历

« 2024-05-05  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 18958
  • 日志数: 19
  • 建立时间: 2011-03-10
  • 更新时间: 2012-08-25

RSS订阅

Open Toolbar