目錄
#!/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