Java代码
#!/bin/bash
array=`mysql -hxx.3.xx.66 -uprofile -p}vM0*4c2e#I7r#/S -N --execute="use profile;select u.id as id,u.name as name,u.email as email,n.number
as number from (select to_id,count(to_id) as number from reward_flower where perf_time_id=53 and status=3 group by to_id ) n ,user u,departme
nt d where n.to_id=u.id and u.department_id=d.id"`
echo "${array[*]}" > dataBase.log
files=dataBase.log
number=`cat dataBase.log|wc -l`
for i in `seq 1 $number`
do
a1=`sed -n "$i"p $files | awk '{print $1}'`
a2=`sed -n "$i"p $files | awk '{print $2}'`
a3=`sed -n "$i"p $files | awk '{print $3}'`
a4=`sed -n "$i"p $files | awk '{print $4}'`
#for j in `seq 1 $a4`
#do
#mysql -hxx.3.xx.66 -uprofile -p}vM0*4c2e#I7r#/S -N --execute="use profile;insert into score_info(user_id,from_id,from_info,score,status,dat
e_time) values('$a1',2,'获得红花',30,2,'2012-09-15 18:55:45')"
echo "$a1, $a2, $a3 ,$a4"
#score_count=`mysql -hxx.3.xx.66 -uprofile -p}vM0*4c2e#I7r#/S -N --execute="use profile;select * from score_count where user_id='$a1'"`
# if [ "$score_count" ]
# then
total=$[30*$a4]
echo $a1,$a2
mysql -hxx.3.xx.66 -uprofile -p}vM0*4c2e#I7r#/S -N --execute="use profile;insert into score_count(user_id,surplus_score,total_score)
values('$a1',0,'$total')"
# fi
#done
done
本文标题:Java开发中的shell脚本实践,责任编辑:宏鹏,来源:武汉北大青鸟鲁广校区栏目,于2012-11-09 10:12:54发布于北大青鸟鲁广校区。Java开发中的shell脚本实践
预约将免费领取7天课程体验卡
只为您方便就学
专业老师24小时1对1学习指导
定制专属于你的专属学习方案
微信号:17740513250
微信号:17740513250