shell脚本批量生成文件

touch test_{1..300}.txt
#!/bin/sh
source /etc/profile
path="/a/zl/tmp"

if [ ! -d path ];
        then
                mkdir -p $path
fi
for  index in {0..1000}
do
  num=`expr $index / 10`
    tmpPath="${path}/data_${num}"
    if [ ! -d $tmpPath ];
        then
            mkdir -p $tmpPath
    fi
   #输出一个数字到目标文件 echo "${index}" > $tmpPath/bk-${index}.txt done

 

https://blog.csdn.net/zhanglong_4444/article/details/109596322

posted @ 2021-06-22 15:16  小蕊-zr  阅读(781)  评论(0编辑  收藏  举报