Skip to content

Instantly share code, notes, and snippets.

@lyoshenka
Last active April 4, 2016 18:24
Show Gist options
  • Save lyoshenka/d9dd6cb67853bee35e9f7376a619a414 to your computer and use it in GitHub Desktop.
Save lyoshenka/d9dd6cb67853bee35e9f7376a619a414 to your computer and use it in GitHub Desktop.
Finds PHP files that don't have `<?php` on the very first line. These files, when included, will cause extraneous spaces in output.
while IFS= read -r -d '' file; do
if [ "$(head -n 1 "$file")" != '<?php' ]; then
echo "$file";
fi;
done < <(find . -name '*.php' -print0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment