shell 遞歸調用自己


#!/bin/sh
if test "$2" = ""; then
echo "Usage: $0 basedir depth"
exit 1
fi

if test "$2" = "0"; then
exit 0
fi

for i in a b c d e f ; do
path="$1/$i"
mkdir $path || exit 1
sh $0 $path `expr $2 - 1` #這裏:)
done
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章