现在的位置: 首页 > 综合 > 正文

LINUX SH 脚本实例(批量创建测试数据)

2013年09月20日 ⁄ 综合 ⁄ 共 421字 ⁄ 字号 评论关闭

#!/bin/sh

############### Generate numbers UA's CSV file for sipx to import ######

csvfile=test-$(date +%Y%m%d).csv

E_NOARGS=65

number=1

if [ -z "$3" ]
then
echo "Usage: `basename $0` start_call_number number_count sip_password"
echo
exit $E_NOARGS
fi

if [ -f $csvfile ]
then
echo "The $csvfile is exist and delete it now!"
rm -f $csvfile
fi

echo "SEQUENTIAL" >$csvfile

for ((i=$1;i<$1+$2;i++))
do
echo "$i;$number;[authentication username=$i password=$3]" >>$csvfile
((number++))
done

抱歉!评论已关闭.