shell 根据源文件复制生成多个不重复的测试文件的脚本

#!/bin/bash

# generate test data files 

if [ -n "$1" ]
then
    echo 'source: '$1
else
    echo 'useage: '$0' sourceDataFile dstFileCount'     
    exit 0
fi

if [ -n "$2" ]
then
    echo 'dstFileCount: '$2
else
    echo 'useage: '$0' sourceDataFile dstFileCount'     
    exit 0
fi

dt=`date +%Y-%m-%d'-'%H-%M-%S.%N`

#echo $dt

let count=$2

for ((i=1;i<=$count;i++))
do           
    cp $1 'data-'$i'-'$dt'-'$1
done

 

posted on 2022-11-26 11:48  sixiiweb  阅读(28)  评论(0编辑  收藏  举报

导航