代码如下:
#!/bin/sh dosth() #遍历目录 [ $# = 0 ] && { echo “Usage: $0 …”; exit; } for i in `ls $1`
{
#…
}
dirlist()
{
dosth $1
for subitem in `ls $1`
do
if [ -d “$1/$subitem” ]
then
dirlist $1/$subitem
elif [ -f “$1/$subitem” ]
then
dosth $1/$subitem
fi
done
}
do
if [ -d “$1″ ]
then
dirlist $1
fi
done
【关键字:遍历 递归 linux目录】
历史上的今天
- links for 2008-11-08 - 2008
- links for 2007-11-08 - 2007
- 微软Passport的登录流程 - 2005
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment