php 批量脚本检测语法错误

shell 根据参数检测 当前php项目下 的语法错误


#!/bin/bash
function getdir(){
    for el in `ls $1`
    do
       dir_file=$1"/"$el
       if [ -d $dir_file ]
       then
        getdir $dir_file
       else
           ext=${dir_file##*.}
            if [ $ext = 'php' ]
            then
              file_is=`php -l $dir_file`
            #echo $dir_file
                if [[ $file_is =~ "No syntax errors detected" ]]
                then
                    echo $file_is
                    #continue
                else
                    echo $file_is
                fi
            fi
       fi
    done

}

root_dir="/home/wwwroot/zhengshi_system/nianbao_crs_jsj_edu_cn/trunk/public/web"
getdir $1

猜你喜欢

转载自www.cnblogs.com/mengluo/p/11050900.html