zoukankan      html  css  js  c++  java
  • svn-checkout后,循环遍历查找包含某字符串的文件

    这里涉及几个知识点:

    1、安装subversion,不多说了,网上有教程

    2、循环遍历所有目录层级,找相 关文件

    #!/bin/bash
    #########svn checkout项目出来
    svn_data=/data/BAK
    echo  -e "请输入要checkout的svn地址,格式svn://svn.demo.xx.com.cn/svn/xx" 
    read svnurl
    dirname=`echo "$svnurl" | awk -F'/' '{print $5}'`
    echo $dirname
    echo -e "请输入要项目的存储目录"
    read path
    svn checkout $svnurl
    echo "checkout完成"
    mv $dirname $path
    
    #!/bin/bash
    ###########遍历所有目录查找是否包含http:的文件和目录 
    basepath=$(cd `dirname $0`; pwd)
    resultlog=$basepath/result.log
    keywork="http://"
    echo -e "请输入要检查的目录名称"
    read dirname
    >$resultlog
    function getfile(){
            for element in `ls $1`
            do
                    dir_or_file=$1"/"$element
                    if [ -d $dir_or_file ]
                    then
                            getfile $dir_or_file
                    else
                            echo "$dir_or_file======"$dir_or_file
                            temp=`grep -i "http://" $dir_or_file`
                            if [ -n "$temp" ]
                            then
                                    echo "temp=========is not null"$temp
                                    #echo $dir_or_file
                                    echo $dir_or_file"------->>>>" $temp >> $resultlog
                            fi
                    fi
            done
    }
    getfile $dirname
    
  • 相关阅读:
    select top 变量问题
    distinct top執行順序
    Subquery typo with using in(转)
    sql:查询课程号'0312091006'成绩排名第5到第10之间的学生学号
    case when then
    触发器
    索引
    管理事物处理
    053345
    053344
  • 原文地址:https://www.cnblogs.com/sincoolvip/p/9429216.html
Copyright © 2011-2022 走看看