#!/bin/sh

if [ ! -e "index.php" ]
then
	echo "$0: Please execute this script from root directory."
	exit 1
fi

echo "$0: Analysing PHP scripts for syntax errors (lint) ..."
LINT=`find -type f -name "*.php" -exec php -l -f {} 2>&1 \; | grep -v "No syntax errors detected in" | grep -v "FUSE_EDEADLK" | sort --unique`

if [ -n "${LINT}" ]
then
	echo "${LINT}"
else
	echo "$0: No syntax errors found."
fi

#!/bin/sh

if ! test -e "index.php"; then
	echo "$0: Please execute this script from root directory."
	exit 1
fi

echo "$0: Analysing PHP scripts for syntax errors (lint) ..."
LINT=`find -type f -name "*.php" -exec php -l -f {} 2>&1 \; | grep -v "No syntax errors detected in" | grep -v "FUSE_EDEADLK" | sort --unique`

if test "${LINT}" != ""; then
	echo "${LINT}"
else
	echo "$0: No syntax errors found."
fi

--- 
+++ 
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-if [ ! -e "index.php" ]
-then
+if ! test -e "index.php"; then
 	echo "$0: Please execute this script from root directory."
 	exit 1
 fi
@@ -9,8 +8,7 @@
 echo "$0: Analysing PHP scripts for syntax errors (lint) ..."
 LINT=`find -type f -name "*.php" -exec php -l -f {} 2>&1 \; | grep -v "No syntax errors detected in" | grep -v "FUSE_EDEADLK" | sort --unique`
 
-if [ -n "${LINT}" ]
-then
+if test "${LINT}" != ""; then
 	echo "${LINT}"
 else
 	echo "$0: No syntax errors found."
Use [] instead of test.

Signed-off-by: Roland Häder <0d270388f2f92757a5de0f4bd891d3b392c44c4f@mxchange.org>
