Blog posts

Bash Script to Change PHP Files


Today, I've upgraded my server's PHP version to the latest version, and found out that "<?" tag is not being parsed anymore. There might be some parameter in config files, I am not sure. I was in a hurry and decided to go through easy way, which is to change "<?" tag with "<?php" tag. So, I've developed a bash script, which parses every file in current directory and sub-directories.

If you would like to take a peak and use my script, you are welcome to download it from here.

Warning: Script is designed to run only once!!! If you run it multiple times, you will get something like "<?php php php php". If that occurs, you may need to fix sedStr for ! option according to your need (adding a space char is enough) and run script several times with '!' option.

Edited on: 2014-10-29 14:48:44
by zgrw on 2014-10-29 14:32:37