Fix PHP short_open_tags (<?)
This shell script changes all PHP short open tags (<?) in a directory (recursive) to the complete PHP open tag (<?php). Tested only on OSX 10.6 (bash 3.2.48), be sure to check the current state of your working copy code before running this.
# Gets all the files that has PHP short_open_tags
# in the currently directory (recursively)
for filename in `grep -r '<? ' . | grep -v '.git' | cut -d : -f 1 | sort | uniq` then
# Changes all short_open_tags in the file to <?php
sed 's/<\? /<\?php /g' $filename > /tmp/a && mv /tmp/a $filename
done
Original gist: https://gist.github.com/2407874
Written by Augusto Pascutti
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#