【recurrence】...TestRecurrence文件夹下有5个子文件夹分别为1、2...

发布时间:2021-03-22 00:22:39

root目录下建立如下目录结构/root/TestRecurrence/1...5/10...59/100...599(说明,TestRecurrence文件夹下有5个子文件夹分别为1、2、3、4、5,12345这5个文件夹下又分别有10个文件夹,例如1内部有10、11、12...19这10个文件夹,而100至599分别为10-59文件夹下的500个文件,每个文件夹下有10个文件),最后在/root/TestRecurrence/5/59/这个文件夹里再建一个left文件夹,并在left文件夹里存放600-999,一共400个文件

网友回答

【答案】 #!/bin/bash
  for i in {1..5}
   do
   mkdir -p /root/TestRecurrence/$i
   for a in {0..9}
   do
   mkdir -p /root/TestRecurrence/$i/$i$a
   if [ $i -eq 5 ]
   then
   if [ $a -eq 9 ]
   then
   mkdir -p /root/TestRecurrence/$i/$i$a/left
   touch /root/TestRecurrence/$i/$i$a/left/{600..999}
   fi
   fi
   for b in {0..9}
   do
   touch /root/TestRecurrence/$i/$i$a/$i$a$b
   done
   done
  done
以上问题属网友观点,不代表本站立场,仅供参考!