查询4,6级成绩的脚本,批量的哦。
发表于 : 2009-08-20 17:08
代码: 全选
#!/bin/bash
# 查询成绩,参数为准考号
search() {
ID=$1
# 查询并将结果写入<准考号>.txt文件中
curl -e http://cet.99sushe.com \
-d id=$ID http://cet.99sushe.com/getscore.html \
-o $1.txt
# 汇总,将结果加到scores.txt中
if [ -f $1.txt ]
then
cat $1.txt >> scores.txt
echo "" >> scores.txt
else
echo "$1 not found"
fi
}
# 区间[参数1,参数2]的结果
for id in `seq $1 $2`
do
search $id
done
exit 0
存为cetscore
chmod +x cetscore
./cetscore 准考号1 准考号2
PS:shell脚本菜菜鸟,非常感谢IRC上v_v,shellex等人的答疑解惑