All pastes #365500 Raw Edit

Unnamed

public text v1 · immutable
#365500 ·published 2007-02-21 00:25 UTC
rendered paste body
#!/bin/sh
# Perform an simple update on all php-script in current directory + subdirs
# Updates from "<?" to "<?php" (without the quotes)
fileslist=`find . -iname '*.php'`

for textfile in $fileslist
do
        echo -e "\0033[0;32m * \0033[0m Updating $textfile to newer php-standards..."
        cp "${textfile}" "${textfile}.old"
        sed -e 'N;s/<?[\n]/<?php\n/g' "${textfile}.old" > "${textfile}.unique.tmp"
        sed -e 's/<? /<?php/g' "${textfile}.unique.tmp" > "${textfile}.unique.tmp1"
        sed -e 's/<?=/<?php echo/g' "${textfile}.unique.tmp" > "${textfile}"
        rm "${textfile}.unique.tmp"
        rm "${textfile}.unique.tmp1"
done