Created
June 30, 2014 04:23
-
-
Save bells17/541a14294cfef67b891c to your computer and use it in GitHub Desktop.
phpのシンタックスチェック ref: http://qiita.com/bells17/items/d771c375c78747b336c7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# $1 phpの文法チェックをしたいディレクトリ | |
#http://kaworu.jpn.org/kaworu/2007-11-17-2.php | |
flg=0 | |
phpsyntaxcheck() | |
{ | |
for i in `find -E "$1" -regex '.*\.(php|inc)' ` | |
do | |
msg=`php -l "$i"` | |
check=`echo $msg | cut -c 1-25 ` | |
if [ "$check" != 'No syntax errors detected' ] ; then | |
echo $msg | |
echo '' | |
flg=1 | |
fi | |
done | |
} | |
echo '' | |
for i in "$@" | |
do | |
phpsyntaxcheck "$i" | |
done | |
if [ $flg -eq 1 ] ; then | |
echo 'Syntax check error!' | |
else | |
echo 'Syntax check OK!' | |
fi | |
echo '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment