Skip to content

Instantly share code, notes, and snippets.

@ericvanjohnson
Forked from ma2thieu/replace_php_short_tags.sh
Created September 21, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericvanjohnson/305499aec890d5d366ef3e942bd00c49 to your computer and use it in GitHub Desktop.
Save ericvanjohnson/305499aec890d5d366ef3e942bd00c49 to your computer and use it in GitHub Desktop.
replace php short tags (<?) with long one (<?php)
#!/bin/bash
# first short tags with something that is not a letter after
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/(<\?)([^a-zA-Z])/\1php\2/g' '{}'
# then short tags at end of line
find . -iname "*.php" -print0 | xargs -0 -I{} sed -i -r 's/<\?$/<\?php/g' '{}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment