sh 创建目录树

#!/bin/sh

deep=0
loop=10

width=10

func()

{
cd $1
deep= [ $((deep++ )) ]
if [ $deep -gt $loop ] ;then
cd ..
deep= [ $((deep-- )) ]
return
fi
for ((i=0;i<width;i++)) ;do
mkdir tests$i
done
list=`ls`
for d in $list ;do
func $d
done
cd ..
deep= [ $((deep-- )) ]
}
loop=${1:-10 }
width=${2:-10 }
func ./xxx #树根目录位置xxx


你可能感兴趣的