#!/bin/bash LOGFILE=/tmp/my.log echo > $LOGFILE for helper in `ls -1 class/helper/` do echo ========================== $helper ============================ >> $LOGFILE class=`grep '^class' class/helper/$helper | awk -F ' ' '{print $2}'` for fun in `grep 'public function [a-zA-Z]' class/helper/$helper | awk -F ' ' '{print $3}' | awk -F '(' '{print $1}'` do count=`grep -r "$class->$fun(" *|wc -w` if [ $count == 0 ]; then echo "[ unused ] $class->$fun" >> $LOGFILE else echo "[ used ] $class->$fun" >> $LOGFILE fi echo "[`date`] [$helper] $class->$fun (checked: $count)" done done
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。