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

原文地址:https://www.cnblogs.com/ruijie/p/14918727.html