#!/bin/bash
log_file='result.log'
param_file=$1 # 源数据在命令行中指定
log_cmd="tee -a $log_file"
i=1
for line in `cat $param_file`;
do
echo "read line" $i ":" $line | tee -a $log_file
let "i=$i+1"
OLD_IFS=$IFS;IFS=",";
arr=($line) # 分割数据到数组
IFS=$OLD_IFS;
curl_cmd="curl -d 'uId=${arr[0]}&bid=${arr[1]}&bA=${arr[2]}&to=6&bP=30&fddays=5' http://localhost:8080/mi/api/ss/1.0.1/co/apply"
echo `date "+%Y-%m-%d %H:%M:%S"` "start ===>> " $curl_cmd | tee -a $log_file
eval "$curl_cmd 2>&1" | tee -a $log_file # 使用 eval 命令,把错误日志和接口返回结果一并带回,到后续console及日志存储
echo `date "+%Y-%m-%d %H:%M:%S"` "end <<===" $curl_cmd | tee -a $log_file
done
echo `date "+%Y-%m-%d %H:%M:%S"` "over: end of shell" | tee -a $log_file
234,201708222394083443,5000 4211,201782937493274932,3000 23,201749379583475934,2000
#!/bin/bash
log_file='result.log'
param_file=$1
log_cmd="tee -a $log_file"
i=1
while read line;
do
echo "read line" $i ":" $line | tee -a $log_file
let "i=$i+1"
arr=($line)
curl_cmd="curl -d 'uId=${arr[0]}&bid=${arr[1]}&bt=${arr[2]}&toBorrowType=6&borrowPeriod=30&fddays=5' http://localhost/mi/c/1.0.1/c/n"
echo `date "+%Y-%m-%d %H:%M:%S"` "start ===>> " $curl_cmd | tee -a $log_file
#`$curl_cmd` 2>&1 $log_file | tee -a $log_file
eval "$curl_cmd 2>&1" | tee -a $log_file
echo `date "+%Y-%m-%d %H:%M:%S"` "end <<===" $curl_cmd | tee -a $log_file
done < $param_file
echo `date "+%Y-%m-%d %H:%M:%S"` "over: end of shell" | tee -a $log_file
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有