Chinaunix首页 | 论坛 | 博客
  • 博客访问: 335245
  • 博文数量: 89
  • 博客积分: 5152
  • 博客等级: 大校
  • 技术积分: 1155
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-25 15:12
文章分类

全部博文(89)

文章存档

2012年(1)

2011年(5)

2010年(14)

2009年(69)

我的朋友

分类:

2009-08-07 09:17:53

#!/bin/bash
function usage {
echo "Usage: ./$0 DIR"
}
recursive () {
   first_directory=$1
   cd $first_directory
   directory_array=(*);
  
    for directory in ${directory_array[@]}; do
        if [ -d $directory ] ; then
             (( directory_count += 1 ))
             recursive $directory
             echo In Directory : `pwd`
             domywork
             cd ..
        fi
    done
}

function domywork {
for file in `ls *.java`;
do
        # do sth
        grep 'ltable' $file > /dev/null;
        (( a = $? ))
        grep 'ismanagingfocus' $file > /dev/null;
        (( b = $? ))
        grep 'ismanagingfocus = true' $file > /dev/null;
        (( c = $? ))
        if [ $a -eq 0 ]; then

                if [ $b  -gt 0 ]; then
                        echo $directory$file;
                 fi
                 if [ $c  -eq 0 ]; then
                        echo $directory$file;
                 fi

        fi
 
done
}

#check for required parameters
if  [ ${#1} -gt 0  ]; then
cd $1
     echo "In Directory : `pwd`"
     domywork
     recursive "$1"
     echo "$directory_count directories processed."
else
     #print usage information
     usage
fi

阅读(1096) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~