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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM