原文:http://apps.hi.baidu.com/share/detail/20903278
#!/bin/bash
function ergodic(){
for file in ` ls $1 `
do
if [ -d $1"/"$file ]
then
ergodic $1"/"$file
else
local path=$1"/"$file #得到文件的完整的目录
local name=$file #得到文件的名字
#做自己的工作.
fi
done
}
INIT_PATH="/home"
ergodic $INIT_PATH
[好书推荐] 《高级bash编程指南》
http://bbs.linuxpk.com/thread-14353-1-1.html
win下的批处理编程,也有一个讲的比较详细的文档:
http://download.csdn.net/source/2545653