Skip to content

Instantly share code, notes, and snippets.

@foxumon
Created March 3, 2017 20:59
Show Gist options
  • Save foxumon/b2ec9a0d1f4422ee77ca89a7d5fb3c70 to your computer and use it in GitHub Desktop.
Save foxumon/b2ec9a0d1f4422ee77ca89a7d5fb3c70 to your computer and use it in GitHub Desktop.
Delete PHP files with errors
find ... -iname "*.php" -exec php -l {} \; | grep -i "Errors.parsing"
find ... -exec bash -c '
if php -l "$1" >&/dev/null; then
echo "$1: pass" >&/dev/null;
else
sudo rm $1
echo "$1: fail"
fi' -- {} \; | tail -n +1 | head -50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment